Skip to content
This repository has been archived by the owner on Jun 23, 2023. It is now read-only.

Commit

Permalink
修复重载后菜单数目异常
Browse files Browse the repository at this point in the history
  • Loading branch information
Hellobaka committed Mar 3, 2021
1 parent e37cfad commit 94cb1f9
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 2 deletions.
6 changes: 5 additions & 1 deletion Launcher/NotifyIconHelper.cs
Original file line number Diff line number Diff line change
Expand Up @@ -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()
{
Expand Down
2 changes: 1 addition & 1 deletion Launcher/PluginManagment.cs
Original file line number Diff line number Diff line change
Expand Up @@ -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();
Expand All @@ -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);
Expand Down

0 comments on commit 94cb1f9

Please sign in to comment.