// 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 { /// /// Interaction logic for App.xaml /// public partial class App : Application { private static Mutex _mutex; protected override void OnStartup(StartupEventArgs e) { const string appName = "QuickAccent"; _mutex = new Mutex(true, appName, out bool createdNew); if (!createdNew) { // app is already running! Exiting the application Application.Current.Shutdown(); } base.OnStartup(e); } } }