OSDN Git Service

OS再起動時に一覧ウィンドウが全部保存されないのを直す
authorKazuhiro Fujieda <fujieda@users.osdn.me>
Sun, 2 May 2021 06:52:46 +0000 (15:52 +0900)
committerKazuhiro Fujieda <fujieda@users.osdn.me>
Sun, 2 May 2021 06:52:46 +0000 (15:52 +0900)
KancolleSniffer/Forms/ListFormGroup.cs
KancolleSniffer/MainWindow.cs

index 0cb956c..e9d58a7 100644 (file)
@@ -100,5 +100,16 @@ namespace KancolleSniffer.Forms
             foreach (var listForm in _listForms)\r
                 action(listForm);\r
         }\r
+\r
+        public void WaitForCloseAll()\r
+        {\r
+            var start = DateTime.Now;\r
+            do\r
+            {\r
+                Application.DoEvents();\r
+                if (_listForms.All(listFrom => !listFrom.Visible))\r
+                    return;\r
+            } while ((DateTime.Now - start).TotalSeconds < 5);\r
+        }\r
     }\r
 }
\ No newline at end of file
index 0b1460d..4b4fc85 100644 (file)
@@ -256,6 +256,7 @@ namespace KancolleSniffer
             }\r
             if (!SystemShutdown)\r
                 _listFormGroup.Close(); // 各自で終了処理するのでシャットダウン時は不要\r
+            _listFormGroup.WaitForCloseAll();\r
             Config.Location = (Form.WindowState == FormWindowState.Normal ? Form.Bounds : Form.RestoreBounds).Location;\r
             Config.ShowHpInPercent = _c.fleetPanel.ShowHpInPercent;\r
         }\r