feat: 实现单实例应用程序支持

This commit is contained in:
2026-01-17 16:34:18 +08:00
parent 74ca8e4d57
commit 7abd445039
3 changed files with 151 additions and 6 deletions

View File

@@ -572,6 +572,23 @@ namespace TimerApp
this.Activate();
}
public void ActivateFromExternal()
{
if (InvokeRequired)
{
BeginInvoke(new Action(ActivateFromExternal));
return;
}
this.Show();
this.WindowState = FormWindowState.Normal;
this.ShowInTaskbar = true;
this.BringToFront();
this.Activate();
this.TopMost = true;
this.TopMost = false;
}
private void toolStripMenuItemExit_Click(object sender, EventArgs e)
{
_monitor.Stop();