diff --git a/Launcher/NotifyIconHelper.cs b/Launcher/NotifyIconHelper.cs index 9aaa20d..a615ee4 100644 --- a/Launcher/NotifyIconHelper.cs +++ b/Launcher/NotifyIconHelper.cs @@ -132,7 +132,11 @@ public static void HideNotifyIcon() public static void RemoveMenu(string pluginName) { var item = _NotifyIcon.ContextMenu.MenuItems.Find(pluginName, true).First(); - _NotifyIcon.ContextMenu.MenuItems[0].MenuItems.Remove(item); + _NotifyIcon.ContextMenu.MenuItems[2].MenuItems.Remove(item); + } + public static void ClearAppMenu() + { + _NotifyIcon.ContextMenu.MenuItems[2].MenuItems.Clear(); } public static void Quit() { diff --git a/Launcher/PluginManagment.cs b/Launcher/PluginManagment.cs index b6b7e50..633a96e 100644 --- a/Launcher/PluginManagment.cs +++ b/Launcher/PluginManagment.cs @@ -192,7 +192,6 @@ public void UnLoad(Plugin plugin) plugin.dll.CallFunction(FunctionEnums.Functions.Disable); plugin.dll.CallFunction(FunctionEnums.Functions.Exit); plugin.dll.UnLoad(); - NotifyIconHelper.RemoveMenu(plugin.appinfo.Name); Plugins.Remove(plugin); LogHelper.WriteLog(LogLevel.InfoSuccess, "插件卸载", $"插件 {plugin.appinfo.Name} 卸载成功"); plugin = null; GC.Collect(); @@ -208,6 +207,7 @@ public void UnLoad(Plugin plugin) public void UnLoad() { LogHelper.WriteLog("开始卸载插件..."); + NotifyIconHelper.ClearAppMenu(); foreach(var item in AppDomainSave) { var c = Plugins.Find(x => x.iLib == item.Key);