fix:issue #110
This commit is contained in:
@@ -423,7 +423,7 @@ namespace Ink_Canvas
|
|||||||
try
|
try
|
||||||
{
|
{
|
||||||
string exePath = Process.GetCurrentProcess().MainModule.FileName;
|
string exePath = Process.GetCurrentProcess().MainModule.FileName;
|
||||||
Process.Start(exePath);
|
Process.Start(exePath, "-m");
|
||||||
}
|
}
|
||||||
catch { }
|
catch { }
|
||||||
Environment.Exit(1);
|
Environment.Exit(1);
|
||||||
@@ -644,7 +644,7 @@ namespace Ink_Canvas
|
|||||||
try
|
try
|
||||||
{
|
{
|
||||||
string exePath = Process.GetCurrentProcess().MainModule.FileName;
|
string exePath = Process.GetCurrentProcess().MainModule.FileName;
|
||||||
Process.Start(exePath);
|
Process.Start(exePath, "-m");
|
||||||
}
|
}
|
||||||
catch { }
|
catch { }
|
||||||
Environment.Exit(1);
|
Environment.Exit(1);
|
||||||
@@ -704,7 +704,7 @@ namespace Ink_Canvas
|
|||||||
Environment.Exit(1);
|
Environment.Exit(1);
|
||||||
}
|
}
|
||||||
string exePath = Process.GetCurrentProcess().MainModule.FileName;
|
string exePath = Process.GetCurrentProcess().MainModule.FileName;
|
||||||
Process.Start(exePath);
|
Process.Start(exePath, "-m");
|
||||||
}
|
}
|
||||||
// CrashActionType.NoAction 时不重启,直接退出
|
// CrashActionType.NoAction 时不重启,直接退出
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -1643,10 +1643,14 @@ namespace Ink_Canvas {
|
|||||||
}
|
}
|
||||||
|
|
||||||
public void BtnRestart_Click(object sender, RoutedEventArgs e) {
|
public void BtnRestart_Click(object sender, RoutedEventArgs e) {
|
||||||
Process.Start(System.Windows.Forms.Application.ExecutablePath, "-m");
|
try {
|
||||||
App.IsAppExitByUser = true;
|
Process.Start(System.Windows.Forms.Application.ExecutablePath, "-m");
|
||||||
CloseIsFromButton = true;
|
App.IsAppExitByUser = true;
|
||||||
Application.Current.Shutdown();
|
CloseIsFromButton = true;
|
||||||
|
Application.Current.Shutdown();
|
||||||
|
} catch (Exception ex) {
|
||||||
|
LogHelper.NewLog($"重启程序时出错: {ex.Message}");
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
private void SettingsOverlayClick(object sender, MouseButtonEventArgs e) {
|
private void SettingsOverlayClick(object sender, MouseButtonEventArgs e) {
|
||||||
|
|||||||
@@ -62,20 +62,21 @@ namespace Ink_Canvas
|
|||||||
var mainWin = (MainWindow)Current.MainWindow;
|
var mainWin = (MainWindow)Current.MainWindow;
|
||||||
if (mainWin.IsLoaded) {
|
if (mainWin.IsLoaded) {
|
||||||
IsAppExitByUser = true;
|
IsAppExitByUser = true;
|
||||||
|
|
||||||
try {
|
try {
|
||||||
// 启动新实例
|
// 启动新实例,添加 -m 参数允许多实例启动
|
||||||
string exePath = Process.GetCurrentProcess().MainModule.FileName;
|
string exePath = Process.GetCurrentProcess().MainModule.FileName;
|
||||||
ProcessStartInfo startInfo = new ProcessStartInfo();
|
ProcessStartInfo startInfo = new ProcessStartInfo();
|
||||||
startInfo.FileName = exePath;
|
startInfo.FileName = exePath;
|
||||||
|
startInfo.Arguments = "-m";
|
||||||
startInfo.UseShellExecute = true;
|
startInfo.UseShellExecute = true;
|
||||||
|
|
||||||
// 启动进程但不等待
|
// 启动进程但不等待
|
||||||
Process.Start(startInfo);
|
Process.Start(startInfo);
|
||||||
} catch (Exception ex) {
|
} catch (Exception ex) {
|
||||||
LogHelper.NewLog($"重启程序时出错: {ex.Message}");
|
LogHelper.NewLog($"重启程序时出错: {ex.Message}");
|
||||||
}
|
}
|
||||||
|
|
||||||
// 退出当前实例
|
// 退出当前实例
|
||||||
Current.Shutdown();
|
Current.Shutdown();
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user