fix shutdown didn't work issue

This commit is contained in:
qianlifeng
2014-01-06 22:21:08 +08:00
parent 97b5526cc1
commit 13f00edefd
5 changed files with 64 additions and 14 deletions

View File

@@ -1,11 +1,28 @@
using System.Windows;
namespace WinAlfred
{
/// <summary>
/// App.xaml 的交互逻辑
/// </summary>
public partial class App : Application
{
}
}
using System;
using System.Threading;
using System.Windows;
namespace WinAlfred
{
/// <summary>
/// App.xaml 的交互逻辑
/// </summary>
public partial class App : Application
{
protected override void OnStartup(StartupEventArgs e)
{
base.OnStartup(e);
bool startupFlag;
Mutex mutex = new Mutex(true, "WinAlfred", out startupFlag);
if (!startupFlag)
{
Environment.Exit(0);
}
else
{
MainWindow mainWindow = new MainWindow();
mainWindow.Show();
}
}
}
}