From 0f782a4f5f8796c9a91fb0598b8c089d2ecc73ce Mon Sep 17 00:00:00 2001 From: Kazuhiro Fujieda Date: Sat, 5 Sep 2020 17:59:45 +0900 Subject: [PATCH] =?utf8?q?DPI=E3=82=BA=E3=83=BC=E3=83=A0=E6=99=82=E3=81=AB?= =?utf8?q?=E4=B8=80=E8=A6=A7=E3=81=AE=E3=83=AC=E3=82=A4=E3=82=A2=E3=82=A6?= =?utf8?q?=E3=83=88=E3=81=8C=E3=81=8F=E3=81=9A=E3=82=8C=E3=82=8B=E3=81=AE?= =?utf8?q?=E3=82=92=E7=9B=B4=E3=81=99?= MIME-Version: 1.0 Content-Type: text/plain; charset=utf8 Content-Transfer-Encoding: 8bit クラッシュするのを直したときの直し方がまずくScaler.Factorが 設定されるより前にShipListPanelのラベル生成が走っていた。 --- KancolleSniffer/Forms/ListForm.cs | 46 +++++++++++++++------------------------ 1 file changed, 18 insertions(+), 28 deletions(-) diff --git a/KancolleSniffer/Forms/ListForm.cs b/KancolleSniffer/Forms/ListForm.cs index 622d214..af97edd 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 CheckBox[] _shipTypeCheckBoxes; + private readonly CheckBox[] _shipTypeCheckBoxes; private bool _isMaster; private Settings _settings; public const int PanelWidth = 215; @@ -103,32 +103,7 @@ 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, @@ -140,7 +115,12 @@ namespace KancolleSniffer.Forms checkBoxSTypeSubmarine, checkBoxSTypeAuxiliary }; - SetCheckBoxSTypeState(); + battleResultPanel.HpLabelClick += ToggleHpPercent; + shipListPanel.HpLabelClick += ToggleHpPercent; + var swipe = new SwipeScrollify(); + swipe.AddShipListPanel(shipListPanel); + swipe.AddTreeView(itemTreeView); + swipe.AddPanel(fleetPanel); } public void UpdateList() @@ -297,8 +277,16 @@ namespace KancolleSniffer.Forms { AdjustHeader(); SetMinimumSize(); - comboBoxGroup.SelectedItem = _settings.Mode; var config = GetConfig(); + _settings = Settings.FromShipListConfig(config); + if (_settings.ShowHpInPercent) + { + shipListPanel.ToggleHpPercent(); + battleResultPanel.ToggleHpPercent(); + } + LoadShipGroupFromConfig(); + comboBoxGroup.SelectedItem = _settings.Mode; + SetCheckBoxSTypeState(); if (config.Location.X == int.MinValue) return; var bounds = new Rectangle(config.Location, config.Size); @@ -359,6 +347,8 @@ namespace KancolleSniffer.Forms public void SaveConfig() { + if (_settings == null) + return; if (_isMaster) { SaveMasterState(); -- 2.11.0