OSDN Git Service

メインウィンドウと一覧ウィンドウの前後を入れ替え可能にする
authorKazuhiro Fujieda <fujieda@users.osdn.me>
Tue, 2 Apr 2019 13:06:15 +0000 (22:06 +0900)
committerKazuhiro Fujieda <fujieda@users.osdn.me>
Tue, 2 Apr 2019 13:31:52 +0000 (22:31 +0900)
KancolleSniffer/ListForm.cs
KancolleSniffer/MainForm.cs

index 42ec533..6b60bba 100644 (file)
@@ -225,19 +225,14 @@ namespace KancolleSniffer
         private void ShipListForm_FormClosing(object sender, FormClosingEventArgs e)\r
         {\r
             e.Cancel = true;\r
-            if (!Visible)\r
-                return;\r
             var config = _config.ShipList;\r
             StoreShipGroupToConfig();\r
             var bounds = WindowState == FormWindowState.Normal ? Bounds : RestoreBounds;\r
             config.Location = bounds.Location;\r
             config.Size = bounds.Size;\r
             config.Mode = (string)comboBoxGroup.SelectedItem;\r
-            if (e.CloseReason != CloseReason.FormOwnerClosing)\r
-            {\r
-                Hide();\r
-                _config.Save();\r
-            }\r
+            config.Visible = Visible && WindowState == FormWindowState.Normal;\r
+            Hide();\r
         }\r
 \r
         private void StoreShipGroupToConfig()\r
index b97ac34..1e58061 100644 (file)
@@ -84,7 +84,7 @@ namespace KancolleSniffer
             _mainLabels.CreateNDockLabels(panelDock, labelNDock_Click);\r
             panelRepairList.CreateLabels(panelRepairList_Click);\r
             labelPresetAkashiTimer.BackColor = ShipLabel.ColumnColors[1];\r
-            _listForm = new ListForm(_sniffer, _config) {Owner = this};\r
+            _listForm = new ListForm(_sniffer, _config);\r
             _notificationManager = new NotificationManager(Alarm);\r
             _config.Load();\r
             _proxyManager = new ProxyManager(_config, this);\r
@@ -347,11 +347,10 @@ namespace KancolleSniffer
                     }\r
                 }\r
             }\r
-            e.Cancel = false;\r
+            _listForm.Close();\r
             _sniffer.FlashLog();\r
             _config.Location = (WindowState == FormWindowState.Normal ? Bounds : RestoreBounds).Location;\r
             _config.ShowHpInPercent = _mainLabels.ShowHpInPercent;\r
-            _config.ShipList.Visible = _listForm.Visible && _listForm.WindowState == FormWindowState.Normal;\r
             _config.Save();\r
             _sniffer.SaveState();\r
             _proxyManager.Shutdown();\r
@@ -359,7 +358,8 @@ namespace KancolleSniffer
 \r
         private void MainForm_Resize(object sender, EventArgs e)\r
         {\r
-            ShowInTaskbar = !(_config.HideOnMinimized && WindowState == FormWindowState.Minimized);\r
+            _listForm.WindowState = WindowState;\r
+            _listForm.ShowInTaskbar = ShowInTaskbar = !(_config.HideOnMinimized && WindowState == FormWindowState.Minimized);\r
         }\r
 \r
         private void notifyIconMain_MouseDoubleClick(object sender, MouseEventArgs e)\r