sportdog

导航

 

参考文章:

http://blog.csdn.net/xwdpepsi/article/details/6614248

 

protected override void OnStartup(StartupEventArgs e)
{
bool isRuned;
System.Threading.Mutex mutex = new System.Threading.Mutex(true, "OnlyRunOneInstance", out isRuned);//判断是否已存在
if (isRuned)
{
base.OnStartup(e);
this.ShutdownMode = ShutdownMode.OnMainWindowClose;
var starter = new AppStarer();
starter.Start();
}
else
{
MessageBox.Show("程序已启动!", "提示");
}
}

posted on 2018-01-25 10:46  sportdog  阅读(214)  评论(0编辑  收藏  举报