Skip to content

Commit cd53589

Browse files
committed
Update TrayIconApp.cs
1 parent 90e8f28 commit cd53589

File tree

1 file changed

+5
-3
lines changed

1 file changed

+5
-3
lines changed

TrayIconApp.cs

Lines changed: 5 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -58,12 +58,14 @@ public TrayApplicationContext(Action onExit)
5858

5959
private void OnExit(object sender, EventArgs e)
6060
{
61-
// 先调用 Main 中传来的退出逻辑
6261
onExitAction?.Invoke();
63-
// 再关闭托盘线程
64-
ExitThread();
62+
notifyIcon.Visible = false;
63+
notifyIcon.Dispose();
64+
trayIcon?.Dispose();
65+
Environment.Exit(0);
6566
}
6667

68+
6769
protected override void ExitThreadCore()
6870
{
6971
if (notifyIcon != null)

0 commit comments

Comments
 (0)