From adf5e5c572a23df4b1908ee540c776ae52a7652b Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E5=A7=9A=E5=BD=AA?= <1315508912@qq.com> Date: Tue, 5 Mar 2024 21:19:31 +0800 Subject: [PATCH] =?UTF-8?q?feat:=20=E4=BB=85=E5=85=81=E8=AE=B8=E5=8D=95?= =?UTF-8?q?=E5=AE=9E=E4=BE=8B=E5=90=8C=E6=97=B6=E8=BF=90=E8=A1=8C?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- DownKyi/App.axaml.cs | 9 ++++++++- 1 file changed, 8 insertions(+), 1 deletion(-) diff --git a/DownKyi/App.axaml.cs b/DownKyi/App.axaml.cs index f5b692c..42f38cb 100644 --- a/DownKyi/App.axaml.cs +++ b/DownKyi/App.axaml.cs @@ -2,6 +2,7 @@ using System; using System.Collections.ObjectModel; using System.Collections.Specialized; using System.Linq; +using System.Threading; using System.Threading.Tasks; using Avalonia; using Avalonia.Controls; @@ -45,13 +46,19 @@ public partial class App : PrismApplication public override void Initialize() { + var mutex = new Mutex(true, "Global\\DownKyi", out var createdNew); + if (!createdNew) + { + Environment.Exit(0); + } + AvaloniaXamlLoader.Load(this); if (ApplicationLifetime is IClassicDesktopStyleApplicationLifetime desktop) { desktop.Exit += OnExit!; AppLife = desktop; } - + base.Initialize(); }