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)