diff --git a/Ink Canvas/App.xaml.cs b/Ink Canvas/App.xaml.cs index 96ebe191..1cc27889 100644 --- a/Ink Canvas/App.xaml.cs +++ b/Ink Canvas/App.xaml.cs @@ -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); } diff --git a/Ink Canvas/MainWindow.xaml.cs b/Ink Canvas/MainWindow.xaml.cs index 1dc5b914..2ea61b68 100644 --- a/Ink Canvas/MainWindow.xaml.cs +++ b/Ink Canvas/MainWindow.xaml.cs @@ -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})"); diff --git a/Ink Canvas/MainWindow_cs/MW_FloatingBarIcons.cs b/Ink Canvas/MainWindow_cs/MW_FloatingBarIcons.cs index b0db516d..e60f8f40 100644 --- a/Ink Canvas/MainWindow_cs/MW_FloatingBarIcons.cs +++ b/Ink Canvas/MainWindow_cs/MW_FloatingBarIcons.cs @@ -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(); } diff --git a/Ink Canvas/MainWindow_cs/MW_TrayIcon.cs b/Ink Canvas/MainWindow_cs/MW_TrayIcon.cs index a9f2a84a..880303de 100644 --- a/Ink Canvas/MainWindow_cs/MW_TrayIcon.cs +++ b/Ink Canvas/MainWindow_cs/MW_TrayIcon.cs @@ -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) { diff --git a/Ink Canvas/dist/Aspose.Slides.dll b/Ink Canvas/dist/Aspose.Slides.dll deleted file mode 100644 index 4d573f64..00000000 Binary files a/Ink Canvas/dist/Aspose.Slides.dll and /dev/null differ diff --git a/Ink Canvas/dist/InkCanvasForClass.exe b/Ink Canvas/dist/InkCanvasForClass.exe index e7946461..614399be 100644 Binary files a/Ink Canvas/dist/InkCanvasForClass.exe and b/Ink Canvas/dist/InkCanvasForClass.exe differ diff --git a/Ink Canvas/obj/Debug/net472/InkCanvasForClass.g.resources b/Ink Canvas/obj/Debug/net472/InkCanvasForClass.g.resources index b9aed582..71daf9f6 100644 Binary files a/Ink Canvas/obj/Debug/net472/InkCanvasForClass.g.resources and b/Ink Canvas/obj/Debug/net472/InkCanvasForClass.g.resources differ diff --git a/Ink Canvas/obj/Debug/net472/MainWindow.g.cs b/Ink Canvas/obj/Debug/net472/MainWindow.g.cs index ee7215f6..0b9c9db9 100644 --- a/Ink Canvas/obj/Debug/net472/MainWindow.g.cs +++ b/Ink Canvas/obj/Debug/net472/MainWindow.g.cs @@ -1,4 +1,4 @@ -#pragma checksum "..\..\..\MainWindow.xaml" "{ff1816ec-aa5e-4d10-87f7-6f4963833460}" "DBB5B5D5CB8F12743D815ED76ACFDEDD4BE69F19" +#pragma checksum "..\..\..\MainWindow.xaml" "{ff1816ec-aa5e-4d10-87f7-6f4963833460}" "796FF054FB09C7AB91AFE4FAED2E71154DA26166" //------------------------------------------------------------------------------ // // 此代码由工具生成。 diff --git a/Ink Canvas/obj/Debug/net472/MainWindow.g.i.cs b/Ink Canvas/obj/Debug/net472/MainWindow.g.i.cs index ee7215f6..0b9c9db9 100644 --- a/Ink Canvas/obj/Debug/net472/MainWindow.g.i.cs +++ b/Ink Canvas/obj/Debug/net472/MainWindow.g.i.cs @@ -1,4 +1,4 @@ -#pragma checksum "..\..\..\MainWindow.xaml" "{ff1816ec-aa5e-4d10-87f7-6f4963833460}" "DBB5B5D5CB8F12743D815ED76ACFDEDD4BE69F19" +#pragma checksum "..\..\..\MainWindow.xaml" "{ff1816ec-aa5e-4d10-87f7-6f4963833460}" "796FF054FB09C7AB91AFE4FAED2E71154DA26166" //------------------------------------------------------------------------------ // // 此代码由工具生成。 diff --git a/Ink_Canvas/MainWindow_cs/MW_FloatingBarIcons.cs b/Ink_Canvas/MainWindow_cs/MW_FloatingBarIcons.cs deleted file mode 100644 index a10f5629..00000000 --- a/Ink_Canvas/MainWindow_cs/MW_FloatingBarIcons.cs +++ /dev/null @@ -1,45 +0,0 @@ -#region 主要的工具按鈕事件 - -/// -/// 计算任务栏高度,桌面模式下仅计算任务栏自身高度 -/// -private double CalculateToolbarHeight(bool isDesktopMode) -{ - if (isDesktopMode) - { - // 桌面模式: 任务栏高度 = 主屏幕高度 - 全屏可用高度 - return SystemParameters.PrimaryScreenHeight - SystemParameters.FullPrimaryScreenHeight; - } - else - { - // 其他模式: 原有计算方式(包含窗口标题栏) - return SystemParameters.PrimaryScreenHeight - - SystemParameters.FullPrimaryScreenHeight - - SystemParameters.WindowCaptionHeight; - } -} - -#endregion - -public async void ViewboxFloatingBarMarginAnimation(int MarginFromEdge, - bool PosXCaculatedWithTaskbarHeight = false) -{ - - // 删除旧计算方式 - // var toolbarHeight = System.Windows.SystemParameters.PrimaryScreenHeight - System.Windows.SystemParameters.FullPrimaryScreenHeight - System.Windows.SystemParameters.WindowCaptionHeight; - - // 替换为新计算方式 - var toolbarHeight = CalculateToolbarHeight(Topmost == false); - -} - -public async void PureViewboxFloatingBarMarginAnimationInDesktopMode() -{ - // 删除旧计算方式 - // var toolbarHeight = System.Windows.SystemParameters.PrimaryScreenHeight - System.Windows.SystemParameters.FullPrimaryScreenHeight - System.Windows.SystemParameters.WindowCaptionHeight; - - // 替换为新计算方式(桌面模式专用) - var toolbarHeight = System.Windows.SystemParameters.PrimaryScreenHeight - - System.Windows.SystemParameters.FullPrimaryScreenHeight; - -}