diff --git a/CRSim/App.xaml.cs b/CRSim/App.xaml.cs index 4123f7d..a7a68ee 100644 --- a/CRSim/App.xaml.cs +++ b/CRSim/App.xaml.cs @@ -6,10 +6,18 @@ public static MainWindow MainWindow; public string[] commandLineArgs; public CommandLineOptions parsedOptions; - public static string AppVersion { get; set; } = Assembly.GetAssembly(typeof(App)).GetName().Version.ToString(); + public static string AppVersion { get; set; } = Assembly.GetAssembly(typeof(App)).GetName().Version.ToString(); + private Mutex mutex; public App() { + bool isNewInstance; + mutex = new Mutex(true,"CRSim",out isNewInstance); + if (!isNewInstance) + { + Environment.Exit(0); + } + var args = Environment.GetCommandLineArgs(); parsedOptions = CommandLineParser.Parse(args); if (parsedOptions.Debug) diff --git a/CRSim/Properties/GlobalUsing.cs b/CRSim/Properties/GlobalUsing.cs index 71cc718..c5a27e9 100644 --- a/CRSim/Properties/GlobalUsing.cs +++ b/CRSim/Properties/GlobalUsing.cs @@ -8,6 +8,7 @@ global using System.Collections.Generic; global using System.Collections.ObjectModel; global using System.Reflection; global using System.Timers; +global using System.Threading; global using Microsoft.UI.Xaml; global using Microsoft.UI.Xaml.Controls;