Merge pull request 'C2024-029 RO Editor - Referenced Object Definition Form - Add check if items changed before prompting to possibly save' (#431) from C2024-029 into Development
good for testing phase
This commit is contained in:
commit
2f974d7b52
@ -1542,7 +1542,7 @@ namespace ROEditor
|
|||||||
//only close if they say "Yes, they want to"
|
//only close if they say "Yes, they want to"
|
||||||
protected override void OnFormClosing(FormClosingEventArgs e)
|
protected override void OnFormClosing(FormClosingEventArgs e)
|
||||||
{
|
{
|
||||||
if (this.DialogResult != System.Windows.Forms.DialogResult.OK && !CloseCancel())
|
if (this.DialogResult != System.Windows.Forms.DialogResult.OK && IsPendingChange() && !CloseCancel())
|
||||||
{
|
{
|
||||||
e.Cancel = true;
|
e.Cancel = true;
|
||||||
}
|
}
|
||||||
@ -1558,6 +1558,49 @@ namespace ROEditor
|
|||||||
|
|
||||||
return result == DialogResult.Yes;
|
return result == DialogResult.Yes;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
//return true if a field has been modified
|
||||||
|
private bool IsPendingChange()
|
||||||
|
{
|
||||||
|
if (origRetVal != this.tbRetVal.Text)
|
||||||
|
return true;
|
||||||
|
|
||||||
|
if (origMenuItem != this.tbMenuVal.Text)
|
||||||
|
return true;
|
||||||
|
|
||||||
|
// check if in use records have changed
|
||||||
|
string inuserecs = null;
|
||||||
|
ROField rof;
|
||||||
|
for (int i = 0; i < InUseList.Count; i++)
|
||||||
|
{
|
||||||
|
rof = (ROField)InUseList[i];
|
||||||
|
if (rof.GetFieldname != null) //DO YET: why null?
|
||||||
|
{
|
||||||
|
inuserecs = inuserecs + rof.GetRecID;
|
||||||
|
if (i + 1 < InUseList.Count) inuserecs = inuserecs + " ";
|
||||||
|
}
|
||||||
|
}
|
||||||
|
if (inuserecs != origFieldsInUse)
|
||||||
|
return true;
|
||||||
|
|
||||||
|
|
||||||
|
//check if applicability fields have changed
|
||||||
|
string applicfieldrecs = null;
|
||||||
|
for (int i = 0; i < InUseApplcList.Count; i++)
|
||||||
|
{
|
||||||
|
rof = (ROField)InUseApplcList[i];
|
||||||
|
if (rof.GetFieldname != null)
|
||||||
|
{
|
||||||
|
applicfieldrecs = applicfieldrecs + rof.GetRecID;
|
||||||
|
if (i + 1 < InUseApplcList.Count) applicfieldrecs = applicfieldrecs + " ";
|
||||||
|
}
|
||||||
|
}
|
||||||
|
if (applicfieldrecs != origApplicFields)
|
||||||
|
return true;
|
||||||
|
|
||||||
|
//nothing has changed
|
||||||
|
return false;
|
||||||
|
}
|
||||||
#endregion
|
#endregion
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
Loading…
x
Reference in New Issue
Block a user