From 74b64bd21f02593a6d66003ec1bf4b1c83c55ef5 Mon Sep 17 00:00:00 2001 From: CJKmkp <2564608840@qq.com> Date: Sat, 21 Mar 2026 16:13:42 +0800 Subject: [PATCH] =?UTF-8?q?=E4=BB=A3=E7=A0=81=E4=BC=98=E5=8C=96?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- Ink Canvas/App.xaml.cs | 14 +++++++------- Ink Canvas/Helpers/InkFadeManager.cs | 4 +--- Ink Canvas/Helpers/PPTManager.cs | 20 ++++++++++---------- Ink Canvas/MainWindow.xaml.cs | 4 +--- Ink Canvas/MainWindow_cs/MW_Timer.cs | 3 +-- 5 files changed, 20 insertions(+), 25 deletions(-) diff --git a/Ink Canvas/App.xaml.cs b/Ink Canvas/App.xaml.cs index 058ed2f1..787cbc0b 100644 --- a/Ink Canvas/App.xaml.cs +++ b/Ink Canvas/App.xaml.cs @@ -1,8 +1,10 @@ using Hardcodet.Wpf.TaskbarNotification; using Ink_Canvas.Helpers; +using Ink_Canvas.Properties; using iNKORE.UI.WPF.Modern.Controls; using Microsoft.Win32; using Newtonsoft.Json; +using Sentry; using System; using System.Diagnostics; using System.IO; @@ -18,10 +20,8 @@ using System.Windows.Input; using System.Windows.Threading; using Application = System.Windows.Application; using MessageBox = System.Windows.MessageBox; -using Ink_Canvas.Properties; using SplashScreen = Ink_Canvas.Windows.SplashScreen; using Timer = System.Threading.Timer; -using Sentry; namespace Ink_Canvas { @@ -1088,7 +1088,7 @@ namespace Ink_Canvas LogHelper.WriteLogToFile($"启动完成心跳已记录"); } LogHelper.WriteLogToFile($"启动时长: {(startupCompleteHeartbeat - appStartupStartTime).TotalSeconds:F2}秒"); - + if (_isSplashScreenShown) { SetSplashMessage("完成初始化..."); @@ -1223,8 +1223,8 @@ namespace Ink_Canvas if (!isStartupComplete && appStartupStartTime != DateTime.MinValue) { - DateTime startTime = _isSplashScreenShown && splashScreenStartTime != DateTime.MinValue - ? splashScreenStartTime + DateTime startTime = _isSplashScreenShown && splashScreenStartTime != DateTime.MinValue + ? splashScreenStartTime : appStartupStartTime; TimeSpan elapsedSinceStart = DateTime.Now - startTime; if (elapsedSinceStart.TotalMinutes >= 2) @@ -1405,7 +1405,7 @@ namespace Ink_Canvas string assemblyLocation = Assembly.GetExecutingAssembly().Location; string currentDir = Path.GetDirectoryName(assemblyLocation); - + for (int i = 0; i < 5; i++) { string dsnFilePath = Path.Combine(currentDir, "telemetry_dsn.txt"); @@ -1417,7 +1417,7 @@ namespace Ink_Canvas return dsn; } } - + DirectoryInfo parentDir = Directory.GetParent(currentDir); if (parentDir == null) { diff --git a/Ink Canvas/Helpers/InkFadeManager.cs b/Ink Canvas/Helpers/InkFadeManager.cs index 23d74ef5..c734ca5c 100644 --- a/Ink Canvas/Helpers/InkFadeManager.cs +++ b/Ink Canvas/Helpers/InkFadeManager.cs @@ -264,7 +264,6 @@ namespace Ink_Canvas.Helpers public void Enable() { IsEnabled = true; - LogHelper.WriteLogToFile("墨迹渐隐功能已启用"); } /// @@ -273,7 +272,6 @@ namespace Ink_Canvas.Helpers public void Disable() { IsEnabled = false; - LogHelper.WriteLogToFile("墨迹渐隐功能已禁用"); } #endregion @@ -894,4 +892,4 @@ namespace Ink_Canvas.Helpers } #endregion } -} \ No newline at end of file +} diff --git a/Ink Canvas/Helpers/PPTManager.cs b/Ink Canvas/Helpers/PPTManager.cs index c2e252c5..04ead0a9 100644 --- a/Ink Canvas/Helpers/PPTManager.cs +++ b/Ink Canvas/Helpers/PPTManager.cs @@ -150,13 +150,13 @@ namespace Ink_Canvas.Helpers private void CheckAndConnectToPPT() { if (_isModuleUnloading) return; - + lock (_lockObject) { try { if (_isModuleUnloading) return; - + // 尝试连接到PowerPoint var pptApp = TryConnectToPowerPoint(); if (pptApp == null && IsSupportWPS) @@ -421,7 +421,7 @@ namespace Ink_Canvas.Helpers SafeReleaseComObject(CurrentSlide, "CurrentSlide"); SafeReleaseComObject(CurrentSlides, "CurrentSlides"); SafeReleaseComObject(CurrentPresentation, "CurrentPresentation"); - + if (PPTApplication != null && Marshal.IsComObject(PPTApplication)) { try @@ -474,13 +474,13 @@ namespace Ink_Canvas.Helpers _isModuleUnloading = false; return; } - + GC.Collect(); GC.WaitForPendingFinalizers(); GC.Collect(); - + Thread.Sleep(1000); - + _isModuleUnloading = false; try @@ -494,7 +494,7 @@ namespace Ink_Canvas.Helpers { LogHelper.WriteLogToFile("PPT联动模块重载时计时器已释放,跳过重启", LogHelper.LogType.Trace); } - + LogHelper.WriteLogToFile("PPT联动模块已重新加载", LogHelper.LogType.Trace); } catch (Exception ex) @@ -555,7 +555,7 @@ namespace Ink_Canvas.Helpers object view = null; object selection = null; object slideRange = null; - + try { if (PPTApplication != null && Marshal.IsComObject(PPTApplication)) @@ -605,7 +605,7 @@ namespace Ink_Canvas.Helpers if (view != null) { dynamic viewObj = view; - CurrentSlide = viewObj.Slide as Slide; + CurrentSlide = viewObj.Slide as Slide; } } } @@ -632,7 +632,7 @@ namespace Ink_Canvas.Helpers } } } - + if (CurrentSlide == null && SlidesCount > 0) { CurrentSlide = CurrentSlides[1]; diff --git a/Ink Canvas/MainWindow.xaml.cs b/Ink Canvas/MainWindow.xaml.cs index 9fe9278b..6b182ed6 100644 --- a/Ink Canvas/MainWindow.xaml.cs +++ b/Ink Canvas/MainWindow.xaml.cs @@ -3535,7 +3535,6 @@ namespace Ink_Canvas ToggleSwitchInkFadeInPanel2.IsOn = Settings.Canvas.EnableInkFade; } - LogHelper.WriteLogToFile($"墨迹渐隐功能已{(Settings.Canvas.EnableInkFade ? "启用" : "禁用")}", LogHelper.LogType.Event); } catch (Exception ex) { @@ -3587,7 +3586,6 @@ namespace Ink_Canvas ToggleSwitchInkFadeInPanel2.IsOn = Settings.Canvas.EnableInkFade; } - LogHelper.WriteLogToFile($"批注子面板中墨迹渐隐功能已{(Settings.Canvas.EnableInkFade ? "启用" : "禁用")}", LogHelper.LogType.Event); } catch (Exception ex) { @@ -4812,4 +4810,4 @@ namespace Ink_Canvas #endregion } -} \ No newline at end of file +} diff --git a/Ink Canvas/MainWindow_cs/MW_Timer.cs b/Ink Canvas/MainWindow_cs/MW_Timer.cs index c51f68e5..f6ad197d 100644 --- a/Ink Canvas/MainWindow_cs/MW_Timer.cs +++ b/Ink Canvas/MainWindow_cs/MW_Timer.cs @@ -1441,7 +1441,6 @@ namespace Ink_Canvas if (_eraserAutoSwitchBackTimer != null) { _eraserAutoSwitchBackTimer.Stop(); - LogHelper.WriteLogToFile("橡皮擦自动切换计时器已停止", LogHelper.LogType.Trace); } } catch (Exception ex) @@ -1486,4 +1485,4 @@ namespace Ink_Canvas } } } -} \ No newline at end of file +}