更新启动
This commit is contained in:
@@ -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;
|
||||
|
||||
Reference in New Issue
Block a user