参考文章:
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("程序已启动!", "提示");
}
}