From 446653e488994bf97f12a6139dc0f8f5521d1b92 Mon Sep 17 00:00:00 2001 From: Demo_Liu Date: Tue, 20 Jul 2021 21:12:18 +0800 Subject: [PATCH] =?UTF-8?q?=E5=8D=95=E5=AE=9E=E4=BE=8B=E8=BF=90=E8=A1=8C?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- App.xaml.cs | 10 ++++++++-- 1 file changed, 8 insertions(+), 2 deletions(-) diff --git a/App.xaml.cs b/App.xaml.cs index 323a35b..4c7ba9a 100644 --- a/App.xaml.cs +++ b/App.xaml.cs @@ -11,15 +11,21 @@ namespace GeekDesk /// public partial class App : Application { + System.Threading.Mutex mutex; + + public App() + { + this.Startup += new StartupEventHandler(App_Startup); + } + private void App_Startup(object sender, StartupEventArgs e) { + bool ret; mutex = new System.Threading.Mutex(true, "GeekDesk", out ret); - if (!ret) { - MessageBox.Show("已有一个客户端正在运行,请先结束原来客户端!"); Environment.Exit(0); } #region 设置程序开机自动运行(+注册表项)