|
@@ -87,10 +87,40 @@ namespace PRSDesktop
|
|
|
{
|
|
|
return new Dictionary<string, object[]>();
|
|
|
}
|
|
|
+
|
|
|
+ private void CheckSaved(CancelEventArgs cancel)
|
|
|
+ {
|
|
|
+ var result = MessageBox.Show("You have changes that have not been saved; do you wish to save these changes?", "Save Changes?", MessageBoxButton.YesNoCancel);
|
|
|
+ if (result == MessageBoxResult.Yes)
|
|
|
+ {
|
|
|
+ Editor.SaveItem(cancel);
|
|
|
+ if (!cancel.Cancel)
|
|
|
+ {
|
|
|
+ MessageBox.Show("Purchase Order saved.");
|
|
|
+ }
|
|
|
+ }
|
|
|
+ else if (result == MessageBoxResult.Cancel)
|
|
|
+ {
|
|
|
+ cancel.Cancel = true;
|
|
|
+ }
|
|
|
+ }
|
|
|
+ private bool CheckSaved()
|
|
|
+ {
|
|
|
+ var cancel = new CancelEventArgs();
|
|
|
+ CheckSaved(cancel);
|
|
|
+ return !cancel.Cancel;
|
|
|
+ }
|
|
|
|
|
|
public void Shutdown(CancelEventArgs? cancel)
|
|
|
{
|
|
|
- ScanPanel.Shutdown(cancel);
|
|
|
+
|
|
|
+ if(bChanged)
|
|
|
+ {
|
|
|
+ CheckSaved(cancel);
|
|
|
+ }
|
|
|
+
|
|
|
+ if (cancel.Cancel == false)
|
|
|
+ ScanPanel.Shutdown(cancel);
|
|
|
}
|
|
|
|
|
|
#region Host
|
|
@@ -147,8 +177,14 @@ namespace PRSDesktop
|
|
|
|
|
|
private bool EditorChanged = false;
|
|
|
|
|
|
+
|
|
|
+ private bool bChanged = true;
|
|
|
+
|
|
|
private IDynamicDataGrid UpdateEditor(Type TEntity, BaseObject[]? items)
|
|
|
{
|
|
|
+ bChanged = false;
|
|
|
+ ScanPanel.ScanGrid.IsEnabled = true;
|
|
|
+
|
|
|
DetailBorder.Child = null;
|
|
|
|
|
|
Editor = new EmbeddedDynamicEditorForm();
|
|
@@ -169,12 +205,22 @@ namespace PRSDesktop
|
|
|
{
|
|
|
var cancel = new System.ComponentModel.CancelEventArgs();
|
|
|
Editor.SaveItem(cancel);
|
|
|
- if(!cancel.Cancel)
|
|
|
+ if (!cancel.Cancel)
|
|
|
+ {
|
|
|
ClearEditor(TEntity);
|
|
|
+ bChanged = false;
|
|
|
+ ScanPanel.ScanGrid.IsEnabled = true; }
|
|
|
};
|
|
|
Editor.OnCancel += () =>
|
|
|
{
|
|
|
ClearEditor(TEntity);
|
|
|
+ bChanged = false;
|
|
|
+ ScanPanel.ScanGrid.IsEnabled = true;
|
|
|
+ };
|
|
|
+ Editor.OnChanged += (sender, args) =>
|
|
|
+ {
|
|
|
+ bChanged = true;
|
|
|
+ ScanPanel.ScanGrid.IsEnabled = false;
|
|
|
};
|
|
|
|
|
|
DetailBorder.Child = Editor;
|