From ec2d793e4980589e2ab3380f619037baa1cb3079 Mon Sep 17 00:00:00 2001 From: niuzhix <35690637@qq.com> Date: Thu, 7 Aug 2025 07:43:57 +0800 Subject: [PATCH] =?UTF-8?q?feat:=20=E5=A2=9E=E5=8A=A0=E4=BA=92=E6=96=A5?= =?UTF-8?q?=E9=94=81=E4=BB=A5=E9=98=B2=E6=AD=A2=E5=A4=9A=E8=BF=9B=E7=A8=8B?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- CRSim/App.xaml.cs | 10 +++++++++- CRSim/Properties/GlobalUsing.cs | 1 + 2 files changed, 10 insertions(+), 1 deletion(-) 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;