public class App : Application
{
Mutex mutex = null;
public App()
{
// 어플리케이션 이름 확인
string applicationName = Process.GetCurrentProcess().ProcessName;
Duplicate_execution(applicationName);
}
/// <summary>
/// 중복실행방지
/// </summary>
/// <param name="mutexName"></param>
private void Duplicate_execution(string mutexName)
{
try
{
mutex = new Mutex(false, mutexName);
}
catch (Exception ex)
{
Application.Current.Shutdown();
}
if (mutex.WaitOne(0, false))
{
InitializeComponent();
}
else
{
Application.Current.Shutdown();
}
}