mirror of
https://github.com/microsoft/PowerToys.git
synced 2025-12-16 11:48:06 +01:00
34 lines
862 B
C#
34 lines
862 B
C#
|
|
// Copyright (c) Microsoft Corporation
|
|||
|
|
// The Microsoft Corporation licenses this file to you under the MIT license.
|
|||
|
|
// See the LICENSE file in the project root for more information.
|
|||
|
|
|
|||
|
|
using System.Threading;
|
|||
|
|
using System.Windows;
|
|||
|
|
|
|||
|
|
namespace PowerAccent.UI
|
|||
|
|
{
|
|||
|
|
/// <summary>
|
|||
|
|
/// Interaction logic for App.xaml
|
|||
|
|
/// </summary>
|
|||
|
|
public partial class App : Application
|
|||
|
|
{
|
|||
|
|
private static Mutex _mutex;
|
|||
|
|
|
|||
|
|
protected override void OnStartup(StartupEventArgs e)
|
|||
|
|
{
|
|||
|
|
const string appName = "PowerAccent";
|
|||
|
|
bool createdNew;
|
|||
|
|
|
|||
|
|
_mutex = new Mutex(true, appName, out createdNew);
|
|||
|
|
|
|||
|
|
if (!createdNew)
|
|||
|
|
{
|
|||
|
|
// app is already running! Exiting the application
|
|||
|
|
Application.Current.Shutdown();
|
|||
|
|
}
|
|||
|
|
|
|||
|
|
base.OnStartup(e);
|
|||
|
|
}
|
|||
|
|
}
|
|||
|
|
}
|