From 388896f161b92ad9ea38cfa5cc8a10f385d43731 Mon Sep 17 00:00:00 2001 From: ChsBuffer <33744752+chsbuffer@users.noreply.github.com> Date: Tue, 25 Aug 2020 06:26:27 +0800 Subject: [PATCH] =?UTF-8?q?=E4=BF=AE=E5=A4=8D=E6=A8=A1=E5=BC=8F,=E6=9C=8D?= =?UTF-8?q?=E5=8A=A1=E5=99=A8=E5=8F=98=E6=9B=B4=E5=90=8E=20ComboBox=20?= =?UTF-8?q?=E6=9C=AA=E6=9B=B4=E6=96=B0?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- Netch/Forms/MainForm.MenuStrip.cs | 8 ++++---- Netch/Forms/MainForm.Server_Mode.cs | 1 - Netch/Forms/MainForm.cs | 4 ++++ Netch/Forms/SubscribeForm.cs | 5 +---- 4 files changed, 9 insertions(+), 9 deletions(-) diff --git a/Netch/Forms/MainForm.MenuStrip.cs b/Netch/Forms/MainForm.MenuStrip.cs index 7081fc56..03f01126 100644 --- a/Netch/Forms/MainForm.MenuStrip.cs +++ b/Netch/Forms/MainForm.MenuStrip.cs @@ -83,6 +83,7 @@ namespace Netch.Forms Enabled = false; try { + Modes.Load(); InitMode(); NotifyTip(i18N.Translate("Modes have been reload")); } @@ -104,6 +105,7 @@ namespace Netch.Forms { Hide(); new SubscribeForm().ShowDialog(); + InitServer(); Show(); } @@ -168,10 +170,7 @@ namespace Netch.Forms lock (serverLock) { - foreach (var server in Global.Settings.Server.Where(server => server.Group == item.Remark)) - { - Global.Settings.Server.Remove(server); - } + Global.Settings.Server.RemoveAll(server => server.Group == item.Remark); var result = ShareLink.Parse(str); if (result != null) @@ -196,6 +195,7 @@ namespace Netch.Forms } })).ToArray()); + InitServer(); Configuration.Save(); StatusText(i18N.Translate("Subscription updated")); } diff --git a/Netch/Forms/MainForm.Server_Mode.cs b/Netch/Forms/MainForm.Server_Mode.cs index fbc07f24..f8df38a0 100644 --- a/Netch/Forms/MainForm.Server_Mode.cs +++ b/Netch/Forms/MainForm.Server_Mode.cs @@ -67,7 +67,6 @@ namespace Netch.Forms _comboBoxInitialized = false; ModeComboBox.Items.Clear(); - Modes.Load(); ModeComboBox.Items.AddRange(Global.Modes.ToArray()); SelectLastMode(); _comboBoxInitialized = comboBoxInitialized; diff --git a/Netch/Forms/MainForm.cs b/Netch/Forms/MainForm.cs index 8b1c784b..cd1469c3 100644 --- a/Netch/Forms/MainForm.cs +++ b/Netch/Forms/MainForm.cs @@ -37,6 +37,7 @@ namespace Netch.Forms // 计算 ComboBox绘制 目标宽度 _eWidth = ServerComboBox.Width / 10; + Modes.Load(); InitMode(); InitServer(); _comboBoxInitialized = true; @@ -274,6 +275,7 @@ namespace Netch.Forms }; Hide(); server?.ShowDialog(); + InitServer(); Configuration.Save(); Show(); } @@ -311,6 +313,7 @@ namespace Netch.Forms { Hide(); new Process(selectedMode).ShowDialog(); + InitMode(); Show(); break; } @@ -371,6 +374,7 @@ namespace Netch.Forms var index = ServerComboBox.SelectedIndex; Global.Settings.Server.Remove(ServerComboBox.SelectedItem as Models.Server); + InitServer(); Configuration.Save(); diff --git a/Netch/Forms/SubscribeForm.cs b/Netch/Forms/SubscribeForm.cs index 42431eda..35a921f2 100644 --- a/Netch/Forms/SubscribeForm.cs +++ b/Netch/Forms/SubscribeForm.cs @@ -185,10 +185,7 @@ namespace Netch.Forms private static void DeleteServersInGroup(string group) { - foreach (var server in Global.Settings.Server.ToList().Where(server => server.Group.Equals(group))) - { - Global.Settings.Server.Remove(server); - } + Global.Settings.Server.RemoveAll(server => server.Group == group); } private static void RenameServersGroup(string oldGroup, string newGroup)