From fa0cbb4d3fd038c2d82e277a86fef27936659cef Mon Sep 17 00:00:00 2001
From: CJK_mkp <113243675+CJKmkp@users.noreply.github.com>
Date: Tue, 17 Jun 2025 21:45:50 +0800
Subject: [PATCH] =?UTF-8?q?fix:=E4=BF=AE=E5=A4=8D=E6=97=A5=E5=BF=97?=
=?UTF-8?q?=E9=87=8D=E5=A4=8D=E8=BE=93=E5=87=BA?=
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit
---
Ink Canvas/MainWindow_cs/MW_PPT.cs | 12 +++++++-----
1 file changed, 7 insertions(+), 5 deletions(-)
diff --git a/Ink Canvas/MainWindow_cs/MW_PPT.cs b/Ink Canvas/MainWindow_cs/MW_PPT.cs
index 0e08e430..91de8465 100644
--- a/Ink Canvas/MainWindow_cs/MW_PPT.cs
+++ b/Ink Canvas/MainWindow_cs/MW_PPT.cs
@@ -162,14 +162,16 @@ namespace Ink_Canvas {
///
/// 检查WPS进程是否正在运行
///
- private bool IsWPSRunning()
+ /// 是否记录日志,默认为true
+ private bool IsWPSRunning(bool writeLog = true)
{
foreach (var processName in GetPossibleWPSProcessNames())
{
var processes = Process.GetProcessesByName(processName);
if (processes.Length > 0)
{
- LogHelper.WriteLogToFile($"检测到WPS进程: {processName}", LogHelper.LogType.Info);
+ if (writeLog)
+ LogHelper.WriteLogToFile($"检测到WPS进程: {processName}", LogHelper.LogType.Info);
return true;
}
}
@@ -188,7 +190,7 @@ namespace Ink_Canvas {
if (!isPowerPointInitialized)
{
// 检测WPS和PowerPoint进程
- bool wpsRunning = IsWPSRunning();
+ bool wpsRunning = IsWPSRunning(true);
var pptProcesses = Process.GetProcessesByName("POWERPNT");
// 根据设置和进程状态决定模式
@@ -269,7 +271,7 @@ namespace Ink_Canvas {
}
// 检查进程是否还在
- bool currentWpsRunning = IsWPSRunning();
+ bool currentWpsRunning = IsWPSRunning(false); // 定期检查不输出日志
var currentPptProcesses = Process.GetProcessesByName("POWERPNT");
// 检测应用程序是否关闭
@@ -375,7 +377,7 @@ namespace Ink_Canvas {
}
}
catch (Exception ex) {
- LogHelper.WriteLogToFile(ex.ToString(), LogHelper.LogType.Error);
+ LogHelper.WriteLogToFile($"TimerCheckPPT_Elapsed 异常: {ex.Message}", LogHelper.LogType.Error);
Application.Current.Dispatcher.Invoke(() => {
BtnPPTSlideShow.Visibility = Visibility.Collapsed;
timerCheckPPT.Start();