OSDN Git Service

前回起動時の一覧ウィンドウの状態を再現する
authorKazuhiro Fujieda <fujieda@users.osdn.me>
Sun, 17 Dec 2017 05:51:43 +0000 (14:51 +0900)
committerKazuhiro Fujieda <fujieda@users.osdn.me>
Mon, 18 Dec 2017 12:14:37 +0000 (21:14 +0900)
KancolleSniffer/Config.cs
KancolleSniffer/ListForm.cs
KancolleSniffer/MainForm.cs

index 45fe25e..a27028e 100644 (file)
@@ -40,8 +40,10 @@ namespace KancolleSniffer
 \r
     public class ShipListConfig\r
     {\r
+        public bool Visible { get; set; }\r
         public Point Location { get; set; }\r
         public Size Size { get; set; }\r
+        public string Mode { get; set; }\r
         public bool ShipType { get; set; }\r
         public bool ShowHpInPercent { get; set; }\r
         public ListForm.SortOrder SortOrder { get; set; } = ListForm.SortOrder.ExpToNext;\r
index 682c021..d593bdf 100644 (file)
@@ -144,14 +144,13 @@ namespace KancolleSniffer
             checkBoxShipType.Checked = config.ShipType;\r
             if (config.ShowHpInPercent)\r
                 shipListPanel.ToggleHpPercent();\r
-            ActiveControl = shipListPanel;\r
             for (var i = 0; i < ShipListPanel.GroupCount; i++)\r
             {\r
                 shipListPanel.GroupSettings[i] = i < config.ShipGroup.Count\r
                     ? new HashSet<int>(config.ShipGroup[i])\r
                     : new HashSet<int>();\r
             }\r
-            comboBoxGroup.SelectedIndex = 0;\r
+            comboBoxGroup.SelectedItem = config.Mode ?? "全員";\r
             if (config.Location.X == int.MinValue)\r
                 return;\r
             var bounds = new Rectangle(config.Location, config.Size);\r
@@ -178,6 +177,7 @@ namespace KancolleSniffer
             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
                 Hide();\r
         }\r
index 04aecce..50e6bc2 100644 (file)
@@ -214,6 +214,8 @@ namespace KancolleSniffer
                 ShowInTaskbar = false;\r
             if (_config.ShowHpInPercent)\r
                 _shipLabels.ToggleHpPercent();\r
+            if (_config.ShipList.Visible)\r
+                _listForm.Show();\r
             ApplyConfig();\r
             ApplyDebugLogSetting();\r
             ApplyLogSetting();\r
@@ -270,6 +272,7 @@ namespace KancolleSniffer
             _sniffer.FlashLog();\r
             _config.Location = (WindowState == FormWindowState.Normal ? Bounds : RestoreBounds).Location;\r
             _config.ShowHpInPercent = _shipLabels.ShowHpInPercent;\r
+            _config.ShipList.Visible = _listForm.Visible && _listForm.WindowState == FormWindowState.Normal;\r
             _config.Save();\r
             _proxyManager.Shutdown();\r
             _kancolleDb.Stop();\r