zoulei 1 рік тому
батько
коміт
fb2b6f68cd

+ 10 - 8
XdCxRhDW.App/ExtensionsDev/GridControlEx.cs

@@ -26,7 +26,7 @@ public static class GridControlEx
 {
     class GridTag
     {
-        public GridTag() { }    
+        public GridTag() { }
         public PopupMenu PopupMenu { get; set; }
 
         public BarManager BarM { get; set; }
@@ -76,15 +76,17 @@ public static class GridControlEx
         grid.Load += (sender, e) =>
         {
             var frm = grid.FindForm();
-            if (frm == null) return;
-            frm.FormClosing += (sender2, e2) =>
+            if (frm != null)
             {
-                if (e2.CloseReason == CloseReason.UserClosing)
+                frm.FormClosing += (sender2, e2) =>
                 {
-                    Directory.CreateDirectory("Layout");
-                    grid.MainView?.SaveLayoutToXml($"Layout\\{grid.Name}.xml", OptionsLayoutBase.FullLayout);
-                }
-            };
+                    if (e2.CloseReason == CloseReason.UserClosing||e2.CloseReason== CloseReason.MdiFormClosing)
+                    {
+                        Directory.CreateDirectory("Layout");
+                        grid.MainView?.SaveLayoutToXml($"Layout\\{grid.Name}.xml", OptionsLayoutBase.FullLayout);
+                    }
+                };
+            }
         };
         string file = $"Layout\\{grid.Name}.xml";
         if (File.Exists(file))

+ 0 - 3
XdCxRhDW.App/UserControl/CtrlHome.Designer.cs

@@ -18,9 +18,6 @@ namespace XdCxRhDW.App.UserControl
         /// <param name="disposing">true if managed resources should be disposed; otherwise, false.</param>
         protected override void Dispose(bool disposing)
         {
-            Directory.CreateDirectory("Layout");
-            gridHomeTask.MainView?.SaveLayoutToXml($"Layout\\{gridHomeTask.Name}.xml", OptionsLayoutBase.FullLayout);
-            gridHomePosRes.MainView?.SaveLayoutToXml($"Layout\\{gridHomePosRes.Name}.xml", OptionsLayoutBase.FullLayout);
             if (disposing && (components != null))
             {
                 components.Dispose();