From 7b31307ee9f2d60031af331de905b6551a24dd5d Mon Sep 17 00:00:00 2001 From: Kazuhiro Fujieda Date: Sun, 30 Aug 2020 21:34:19 +0900 Subject: [PATCH] =?utf8?q?=E4=B8=80=E8=A6=A7=E3=82=A6=E3=82=A3=E3=83=B3?= =?utf8?q?=E3=83=89=E3=82=A6=E3=82=92=E4=B8=80=E5=BA=A6=E3=82=82=E8=A1=A8?= =?utf8?q?=E7=A4=BA=E3=81=9B=E3=81=9A=E3=81=AB=E7=B5=82=E4=BA=86=E3=81=99?= =?utf8?q?=E3=82=8B=E3=81=A8=E3=82=A8=E3=83=A9=E3=83=BC=E3=81=AB=E3=81=AA?= =?utf8?q?=E3=82=8B=E3=81=AE=E3=82=92=E7=9B=B4=E3=81=99?= MIME-Version: 1.0 Content-Type: text/plain; charset=utf8 Content-Transfer-Encoding: 8bit --- KancolleSniffer/Forms/ListForm.cs | 44 +++++++++++++++++++++++++-------------- 1 file changed, 28 insertions(+), 16 deletions(-) diff --git a/KancolleSniffer/Forms/ListForm.cs b/KancolleSniffer/Forms/ListForm.cs index ffba887..622d214 100644 --- a/KancolleSniffer/Forms/ListForm.cs +++ b/KancolleSniffer/Forms/ListForm.cs @@ -31,7 +31,7 @@ namespace KancolleSniffer.Forms private readonly Config _config; private readonly Form _form; private readonly MainWindow.TimeOutChecker _suppressActivate; - private readonly CheckBox[] _shipTypeCheckBoxes; + private CheckBox[] _shipTypeCheckBoxes; private bool _isMaster; private Settings _settings; public const int PanelWidth = 215; @@ -103,7 +103,32 @@ namespace KancolleSniffer.Forms _form = main.Form; _sniffer = main.Sniffer; _config = main.Config; + ApplySettings(); + SetupShipTypeCheckBoxes(); _suppressActivate = main.SuppressActivate; + battleResultPanel.HpLabelClick += ToggleHpPercent; + shipListPanel.HpLabelClick += ToggleHpPercent; + var swipe = new SwipeScrollify(); + swipe.AddShipListPanel(shipListPanel); + swipe.AddTreeView(itemTreeView); + swipe.AddPanel(fleetPanel); + } + + private void ApplySettings() + { + var config = GetConfig(); + _settings = Settings.FromShipListConfig(config); + if (_settings.ShowHpInPercent) + { + shipListPanel.ToggleHpPercent(); + battleResultPanel.ToggleHpPercent(); + } + LoadShipGroupFromConfig(); + comboBoxGroup.SelectedItem = _settings.Mode; + } + + private void SetupShipTypeCheckBoxes() + { _shipTypeCheckBoxes = new[] { checkBoxSTypeBattleShip, @@ -115,12 +140,7 @@ namespace KancolleSniffer.Forms checkBoxSTypeSubmarine, checkBoxSTypeAuxiliary }; - battleResultPanel.HpLabelClick += ToggleHpPercent; - shipListPanel.HpLabelClick += ToggleHpPercent; - var swipe = new SwipeScrollify(); - swipe.AddShipListPanel(shipListPanel); - swipe.AddTreeView(itemTreeView); - swipe.AddPanel(fleetPanel); + SetCheckBoxSTypeState(); } public void UpdateList() @@ -277,16 +297,8 @@ namespace KancolleSniffer.Forms { AdjustHeader(); SetMinimumSize(); - var config = GetConfig(); - _settings = Settings.FromShipListConfig(config); - if (_settings.ShowHpInPercent) - { - shipListPanel.ToggleHpPercent(); - battleResultPanel.ToggleHpPercent(); - } - LoadShipGroupFromConfig(); comboBoxGroup.SelectedItem = _settings.Mode; - SetCheckBoxSTypeState(); + var config = GetConfig(); if (config.Location.X == int.MinValue) return; var bounds = new Rectangle(config.Location, config.Size); -- 2.11.0