fix:修复崩溃自动重启的误判
This commit is contained in:
@@ -1,4 +1,4 @@
|
||||
using Hardcodet.Wpf.TaskbarNotification;
|
||||
using Hardcodet.Wpf.TaskbarNotification;
|
||||
using Ink_Canvas.Helpers;
|
||||
using iNKORE.UI.WPF.Modern.Controls;
|
||||
using System;
|
||||
@@ -49,12 +49,11 @@ namespace Ink_Canvas
|
||||
LogHelper.NewLog(e.Exception.ToString());
|
||||
e.Handled = true;
|
||||
|
||||
// 新增:根据设置自动处理崩溃
|
||||
if (CrashAction == CrashActionType.SilentRestart)
|
||||
// 修改:仅当非用户主动退出时才触发自动重启
|
||||
if (CrashAction == CrashActionType.SilentRestart && !IsAppExitByUser)
|
||||
{
|
||||
try
|
||||
{
|
||||
// 静默重启:启动新进程并退出当前进程
|
||||
string exePath = System.Diagnostics.Process.GetCurrentProcess().MainModule.FileName;
|
||||
System.Diagnostics.Process.Start(exePath);
|
||||
}
|
||||
|
||||
@@ -292,8 +292,8 @@ namespace Ink_Canvas {
|
||||
|
||||
[DllImport("user32.dll", SetLastError = true)]
|
||||
public static extern bool MoveWindow(IntPtr hWnd, int X, int Y, int nWidth, int nHeight, bool bRepaint);
|
||||
|
||||
private void MainWindow_OnSizeChanged(object sender, SizeChangedEventArgs e) {
|
||||
|
||||
private void MainWindow_OnSizeChanged(object sender, SizeChangedEventArgs e) {
|
||||
if (Settings.Advanced.IsEnableForceFullScreen) {
|
||||
if (isLoaded) ShowNotification(
|
||||
$"检测到窗口大小变化,已自动恢复到全屏:{System.Windows.Forms.Screen.PrimaryScreen.Bounds.Width}x{System.Windows.Forms.Screen.PrimaryScreen.Bounds.Height}(缩放比例为{System.Windows.Forms.Screen.PrimaryScreen.Bounds.Width / SystemParameters.PrimaryScreenWidth}x{System.Windows.Forms.Screen.PrimaryScreen.Bounds.Height / SystemParameters.PrimaryScreenHeight})");
|
||||
|
||||
@@ -1585,7 +1585,7 @@ namespace Ink_Canvas {
|
||||
|
||||
public void BtnRestart_Click(object sender, RoutedEventArgs e) {
|
||||
Process.Start(System.Windows.Forms.Application.ExecutablePath, "-m");
|
||||
|
||||
App.IsAppExitByUser = true;
|
||||
CloseIsFromButton = true;
|
||||
Application.Current.Shutdown();
|
||||
}
|
||||
|
||||
@@ -63,7 +63,11 @@ namespace Ink_Canvas
|
||||
|
||||
private void RestartAppTrayIconMenuItem_Clicked(object sender, RoutedEventArgs e) {
|
||||
var mainWin = (MainWindow)Application.Current.MainWindow;
|
||||
if (mainWin.IsLoaded) mainWin.BtnRestart_Click(null,null);
|
||||
if (mainWin.IsLoaded) {
|
||||
App.IsAppExitByUser = true;
|
||||
Application.Current.Shutdown();
|
||||
// mainWin.BtnExit_Click(null,null);
|
||||
}
|
||||
}
|
||||
|
||||
private void ForceFullScreenTrayIconMenuItem_Clicked(object sender, RoutedEventArgs e) {
|
||||
|
||||
Vendored
BIN
Binary file not shown.
BIN
Binary file not shown.
Binary file not shown.
@@ -1,4 +1,4 @@
|
||||
#pragma checksum "..\..\..\MainWindow.xaml" "{ff1816ec-aa5e-4d10-87f7-6f4963833460}" "DBB5B5D5CB8F12743D815ED76ACFDEDD4BE69F19"
|
||||
#pragma checksum "..\..\..\MainWindow.xaml" "{ff1816ec-aa5e-4d10-87f7-6f4963833460}" "796FF054FB09C7AB91AFE4FAED2E71154DA26166"
|
||||
//------------------------------------------------------------------------------
|
||||
// <auto-generated>
|
||||
// 此代码由工具生成。
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
#pragma checksum "..\..\..\MainWindow.xaml" "{ff1816ec-aa5e-4d10-87f7-6f4963833460}" "DBB5B5D5CB8F12743D815ED76ACFDEDD4BE69F19"
|
||||
#pragma checksum "..\..\..\MainWindow.xaml" "{ff1816ec-aa5e-4d10-87f7-6f4963833460}" "796FF054FB09C7AB91AFE4FAED2E71154DA26166"
|
||||
//------------------------------------------------------------------------------
|
||||
// <auto-generated>
|
||||
// 此代码由工具生成。
|
||||
|
||||
Reference in New Issue
Block a user