فهرست منبع

Added cancel confirmation on editor when pressing "X" button on window.

Kenric Nugteren 7 ماه پیش
والد
کامیت
c88e0e8dc8
1فایلهای تغییر یافته به همراه16 افزوده شده و 0 حذف شده
  1. 16 0
      inabox.wpf/DynamicGrid/DynamicEditorForm/DynamicEditorForm.xaml.cs

+ 16 - 0
inabox.wpf/DynamicGrid/DynamicEditorForm/DynamicEditorForm.xaml.cs

@@ -151,6 +151,22 @@ namespace InABox.DynamicGrid
 
         private void Window_Closing(object sender, CancelEventArgs e)
         {
+            if (bChanged && DialogResult == null)
+            {
+                var result = MessageWindow.ShowYesNoCancel("Save Changes?", "Confirm");
+                switch (result)
+                {
+                    case MessageWindowResult.Yes:
+                        DialogResult = true;
+                        break;
+                    case MessageWindowResult.No:
+                        DialogResult = false;
+                        break;
+                    case MessageWindowResult.Cancel:
+                        e.Cancel = true;
+                        return;
+                }
+            }
             if (DialogResult == true)
                 Form.SaveItem(e);
         }