From 7182f3554aa8f6298ef087983ba20cb5b3d06ae0 Mon Sep 17 00:00:00 2001 From: CJKmkp <2564608840@qq.com> Date: Tue, 29 Jul 2025 02:33:19 +0800 Subject: [PATCH] Revert "fix:issue #110" This reverts commit f8e4732dcdfc1ca9e2f45e3cb2ede6f1e8a5a796. --- Ink Canvas/App.xaml.cs | 6 +++--- Ink Canvas/MainWindow_cs/MW_FloatingBarIcons.cs | 12 ++++-------- Ink Canvas/MainWindow_cs/MW_TrayIcon.cs | 9 ++++----- 3 files changed, 11 insertions(+), 16 deletions(-) diff --git a/Ink Canvas/App.xaml.cs b/Ink Canvas/App.xaml.cs index 0e97be05..299c22e5 100644 --- a/Ink Canvas/App.xaml.cs +++ b/Ink Canvas/App.xaml.cs @@ -423,7 +423,7 @@ namespace Ink_Canvas try { string exePath = Process.GetCurrentProcess().MainModule.FileName; - Process.Start(exePath, "-m"); + Process.Start(exePath); } catch { } Environment.Exit(1); @@ -654,7 +654,7 @@ namespace Ink_Canvas try { string exePath = Process.GetCurrentProcess().MainModule.FileName; - Process.Start(exePath, "-m"); + Process.Start(exePath); } catch { } Environment.Exit(1); @@ -714,7 +714,7 @@ namespace Ink_Canvas Environment.Exit(1); } string exePath = Process.GetCurrentProcess().MainModule.FileName; - Process.Start(exePath, "-m"); + Process.Start(exePath); } // CrashActionType.NoAction 时不重启,直接退出 } diff --git a/Ink Canvas/MainWindow_cs/MW_FloatingBarIcons.cs b/Ink Canvas/MainWindow_cs/MW_FloatingBarIcons.cs index f457c4aa..6bd57502 100644 --- a/Ink Canvas/MainWindow_cs/MW_FloatingBarIcons.cs +++ b/Ink Canvas/MainWindow_cs/MW_FloatingBarIcons.cs @@ -1654,14 +1654,10 @@ namespace Ink_Canvas { } public void BtnRestart_Click(object sender, RoutedEventArgs e) { - try { - Process.Start(System.Windows.Forms.Application.ExecutablePath, "-m"); - App.IsAppExitByUser = true; - CloseIsFromButton = true; - Application.Current.Shutdown(); - } catch (Exception ex) { - LogHelper.NewLog($"重启程序时出错: {ex.Message}"); - } + Process.Start(System.Windows.Forms.Application.ExecutablePath, "-m"); + App.IsAppExitByUser = true; + CloseIsFromButton = true; + Application.Current.Shutdown(); } private void SettingsOverlayClick(object sender, MouseButtonEventArgs e) { diff --git a/Ink Canvas/MainWindow_cs/MW_TrayIcon.cs b/Ink Canvas/MainWindow_cs/MW_TrayIcon.cs index c182ced8..d3c22217 100644 --- a/Ink Canvas/MainWindow_cs/MW_TrayIcon.cs +++ b/Ink Canvas/MainWindow_cs/MW_TrayIcon.cs @@ -62,21 +62,20 @@ namespace Ink_Canvas var mainWin = (MainWindow)Current.MainWindow; if (mainWin.IsLoaded) { IsAppExitByUser = true; - + try { - // 启动新实例,添加 -m 参数允许多实例启动 + // 启动新实例 string exePath = Process.GetCurrentProcess().MainModule.FileName; ProcessStartInfo startInfo = new ProcessStartInfo(); startInfo.FileName = exePath; - startInfo.Arguments = "-m"; startInfo.UseShellExecute = true; - + // 启动进程但不等待 Process.Start(startInfo); } catch (Exception ex) { LogHelper.NewLog($"重启程序时出错: {ex.Message}"); } - + // 退出当前实例 Current.Shutdown(); }