From 705cd05b2e371d43eefd61402fa87f0cac077ed6 Mon Sep 17 00:00:00 2001 From: MistEO Date: Wed, 29 Jun 2022 22:37:03 +0800 Subject: [PATCH] =?UTF-8?q?fix:=20=E4=BF=AE=E5=A4=8D=E5=8F=B3=E9=94=AE?= =?UTF-8?q?=E7=82=B9=E6=89=98=E7=9B=98=E4=B9=9F=E4=BC=9A=E6=89=93=E5=BC=80?= =?UTF-8?q?=E7=95=8C=E9=9D=A2=E7=9A=84=E9=97=AE=E9=A2=98?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- src/MeoAsstGui/Helper/TrayIcon.cs | 29 ++++++++++++++++++++++++----- 1 file changed, 24 insertions(+), 5 deletions(-) diff --git a/src/MeoAsstGui/Helper/TrayIcon.cs b/src/MeoAsstGui/Helper/TrayIcon.cs index ba39a3e22e..c824abab2b 100644 --- a/src/MeoAsstGui/Helper/TrayIcon.cs +++ b/src/MeoAsstGui/Helper/TrayIcon.cs @@ -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();