优化代码

This commit is contained in:
2025-10-25 19:57:56 +08:00
parent ab73eb9632
commit 7b2a31781c
2 changed files with 13 additions and 3 deletions
+2 -3
View File
@@ -38,7 +38,7 @@ namespace Ink_Canvas
// 新增:标记是否通过--show参数启动
public static bool StartWithShowMode = false;
// 新增:保存看门狗进程对象
private static Process watchdogProcess;
public static Process watchdogProcess;
// 新增:标记是否为软件内主动退出
public static bool IsAppExitByUser;
// 新增:标记是否启用了UIA置顶功能
@@ -438,7 +438,6 @@ namespace Ink_Canvas
{
_splashScreen.CloseSplashScreen();
_isSplashScreenShown = false;
LogHelper.WriteLogToFile("启动画面已关闭");
}
catch (Exception ex)
{
@@ -1034,7 +1033,7 @@ namespace Ink_Canvas
}
// 看门狗进程
private void StartWatchdogIfNeeded()
public static void StartWatchdogIfNeeded()
{
// 避免递归启动
if (Environment.GetCommandLineArgs().Contains("--watchdog")) return;
+11
View File
@@ -3011,6 +3011,14 @@ namespace Ink_Canvas
{
try
{
timerKillProcess.Stop();
if (App.watchdogProcess != null && !App.watchdogProcess.HasExited)
{
App.watchdogProcess.Kill();
App.watchdogProcess = null;
}
// 调用UIAccess DLL
if (Environment.Is64BitProcess)
{
@@ -3020,6 +3028,9 @@ namespace Ink_Canvas
{
PrepareUIAccessX86();
}
App.StartWatchdogIfNeeded();
timerKillProcess.Start();
}
catch (Exception ex)
{