mirror of
https://github.com/MaaAssistantArknights/MaaAssistantArknights.git
synced 2026-07-18 18:20:39 +08:00
fix: 修复右键点托盘也会打开界面的问题
This commit is contained in:
@@ -38,11 +38,16 @@ namespace MeoAsstGui
|
||||
notifyIcon.MouseDoubleClick += OnNotifyIconDoubleClick;
|
||||
App.Current.MainWindow.StateChanged += MainWindow_StateChanged;
|
||||
|
||||
MenuItem menu1 = new System.Windows.Forms.MenuItem("打开 MAA");
|
||||
menu1.Click += App_show;
|
||||
MenuItem menu2 = new System.Windows.Forms.MenuItem("退出");
|
||||
menu2.Click += App_exit;
|
||||
System.Windows.Forms.MenuItem[] menuItems = new MenuItem[] { menu1, menu2 };
|
||||
MenuItem showMenu = new System.Windows.Forms.MenuItem("打开 MAA");
|
||||
showMenu.Click += App_show;
|
||||
// 不知道怎么调用 TaskQueue.LinkStart, 等一个有缘的大佬来写(
|
||||
//MenuItem startMenu = new System.Windows.Forms.MenuItem("开始长草");
|
||||
//startMenu.Click += StartTask;
|
||||
//MenuItem stopMenu = new System.Windows.Forms.MenuItem("全部停止");
|
||||
//stopMenu.Click += StopTask;
|
||||
MenuItem exitMenu = new System.Windows.Forms.MenuItem("退出");
|
||||
exitMenu.Click += App_exit;
|
||||
System.Windows.Forms.MenuItem[] menuItems = new MenuItem[] { showMenu, exitMenu };
|
||||
this.notifyIcon.ContextMenu = new System.Windows.Forms.ContextMenu(menuItems);
|
||||
}
|
||||
|
||||
@@ -61,6 +66,10 @@ namespace MeoAsstGui
|
||||
|
||||
private void NotifyIcon_MouseClick(object sender, MouseEventArgs e)
|
||||
{
|
||||
if (e.Button != MouseButtons.Left)
|
||||
{
|
||||
return;
|
||||
}
|
||||
if (ws == WindowState.Minimized)
|
||||
{
|
||||
ws = App.Current.MainWindow.WindowState = WindowState.Normal;
|
||||
@@ -74,6 +83,16 @@ namespace MeoAsstGui
|
||||
}
|
||||
}
|
||||
|
||||
//private void StartTask(object sender, EventArgs e)
|
||||
//{
|
||||
// 不知道怎么调用 TaskQueue.LinkStart, 等一个有缘的大佬来写(
|
||||
//}
|
||||
|
||||
//private void StopTask(object sender, EventArgs e)
|
||||
//{
|
||||
// 不知道怎么调用 TaskQueue.Stop, 等一个有缘的大佬来写(
|
||||
//}
|
||||
|
||||
private void App_exit(object sender, EventArgs e)
|
||||
{
|
||||
System.Windows.Application.Current.Shutdown();
|
||||
|
||||
Reference in New Issue
Block a user