feat: 实现单实例应用程序支持
This commit is contained in:
17
MainForm.cs
17
MainForm.cs
@@ -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();
|
||||
|
||||
Reference in New Issue
Block a user