From 0ccf78b39296188666c81d12836a0fad509b69cb Mon Sep 17 00:00:00 2001 From: "GukSang.Jin" Date: Mon, 15 Jun 2026 10:46:27 +0800 Subject: [PATCH] =?UTF-8?q?=E6=9B=B4=E6=96=B0=E5=90=AF=E5=8A=A8?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../Program.cs | 13 +++++++++++++ 1 file changed, 13 insertions(+) diff --git a/Footwear Test methodsfor wholeshoe Slipresistanceperformance/Program.cs b/Footwear Test methodsfor wholeshoe Slipresistanceperformance/Program.cs index fda3e79..bee6d39 100644 --- a/Footwear Test methodsfor wholeshoe Slipresistanceperformance/Program.cs +++ b/Footwear Test methodsfor wholeshoe Slipresistanceperformance/Program.cs @@ -3,11 +3,14 @@ using Footwear_Test_methodsfor_wholeshoe_Slipresistanceperformance.Services; using Serilog; using System; using System.IO; +using System.Threading; namespace Footwear_Test_methodsfor_wholeshoe_Slipresistanceperformance { internal sealed class Program { + private const string SingleInstanceMutexName = @"Global\FootwearSlipResistancePerformance"; + [STAThread] public static int Main(string[] args) { @@ -20,6 +23,16 @@ namespace Footwear_Test_methodsfor_wholeshoe_Slipresistanceperformance return MachineLicenseService.RunElevatedInstall(args[1]); } + using var singleInstanceMutex = new Mutex( + initiallyOwned: true, + SingleInstanceMutexName, + out var isFirstInstance); + if (!isFirstInstance) + { + Log.Warning("检测到鞋类整鞋防滑性能试验程序已在运行,本次启动已取消"); + return 0; + } + Log.Information("鞋类整鞋防滑性能试验程序启动"); BuildAvaloniaApp().StartWithClassicDesktopLifetime(args); return 0;