From 19983a113e236c16f8a94aa6886b3f23367df5ca Mon Sep 17 00:00:00 2001
From: CJKmkp <2564608840@qq.com>
Date: Mon, 21 Jul 2025 17:19:27 +0800
Subject: [PATCH] =?UTF-8?q?add:=E8=BF=9B=E5=85=A5PPT=E6=94=BE=E6=98=A0?=
=?UTF-8?q?=E8=87=AA=E5=8A=A8=E5=9B=9E=E5=88=B0=E9=A6=96=E9=A1=B5=20#38?=
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit
---
Ink Canvas/MainWindow.xaml | 8 ++++
Ink Canvas/MainWindow_cs/MW_PPT.cs | 40 ++++++++++++++++++-
Ink Canvas/MainWindow_cs/MW_Settings.cs | 6 +++
Ink Canvas/MainWindow_cs/MW_SettingsToLoad.cs | 1 +
Ink Canvas/Resources/Settings.cs | 2 +
5 files changed, 55 insertions(+), 2 deletions(-)
diff --git a/Ink Canvas/MainWindow.xaml b/Ink Canvas/MainWindow.xaml
index 8a29597a..fb6f1c0f 100644
--- a/Ink Canvas/MainWindow.xaml
+++ b/Ink Canvas/MainWindow.xaml
@@ -1584,6 +1584,14 @@
FontFamily="Microsoft YaHei UI" FontWeight="Bold"
Toggled="ToggleSwitchNotifyPreviousPage_Toggled" />
+
+
+
+
diff --git a/Ink Canvas/MainWindow_cs/MW_PPT.cs b/Ink Canvas/MainWindow_cs/MW_PPT.cs
index 4da91467..62003343 100644
--- a/Ink Canvas/MainWindow_cs/MW_PPT.cs
+++ b/Ink Canvas/MainWindow_cs/MW_PPT.cs
@@ -241,8 +241,29 @@ namespace Ink_Canvas {
}
private void PptApplication_PresentationOpen(Presentation Pres) {
- // 跳转到上次播放页
- if (Settings.PowerPointSettings.IsNotifyPreviousPage)
+ // 新增逻辑:如果开启"重新进入放映时回到首页",则直接跳转第一页
+ if (Settings.PowerPointSettings.IsAlwaysGoToFirstPageOnReenter)
+ {
+ Application.Current.Dispatcher.BeginInvoke(new Action(() => {
+ try
+ {
+ if (presentation == null)
+ {
+ LogHelper.WriteLogToFile("演示文稿为空,无法跳转到首页", LogHelper.LogType.Warning);
+ return;
+ }
+ if (pptApplication != null && pptApplication.SlideShowWindows != null && pptApplication.SlideShowWindows.Count >= 1)
+ presentation.SlideShowWindow.View.GotoSlide(1);
+ else if (presentation.Windows != null && presentation.Windows.Count >= 1)
+ presentation.Windows[1].View.GotoSlide(1);
+ }
+ catch (Exception ex)
+ {
+ LogHelper.WriteLogToFile($"跳转到首页失败: {ex.ToString()}", LogHelper.LogType.Error);
+ }
+ }), DispatcherPriority.Normal);
+ }
+ else if (Settings.PowerPointSettings.IsNotifyPreviousPage)
Application.Current.Dispatcher.BeginInvoke(new Action(() => {
try {
// 添加安全检查
@@ -594,6 +615,21 @@ namespace Ink_Canvas {
LogHelper.WriteLogToFile("PowerPoint Application Slide Show Begin", LogHelper.LogType.Event);
await Application.Current.Dispatcher.InvokeAsync(() => {
+ // 新增:如果设置开启,进入放映时强制跳转到第一页
+ if (Settings.PowerPointSettings.IsAlwaysGoToFirstPageOnReenter)
+ {
+ try
+ {
+ if (Wn != null && Wn.Presentation != null && Wn.View != null)
+ {
+ Wn.View.GotoSlide(1);
+ }
+ }
+ catch (Exception ex)
+ {
+ LogHelper.WriteLogToFile($"放映开始时跳转首页失败: {ex.ToString()}", LogHelper.LogType.Error);
+ }
+ }
//调整颜色
var screenRatio = SystemParameters.PrimaryScreenWidth / SystemParameters.PrimaryScreenHeight;
diff --git a/Ink Canvas/MainWindow_cs/MW_Settings.cs b/Ink Canvas/MainWindow_cs/MW_Settings.cs
index 66c3cf70..624ad77c 100644
--- a/Ink Canvas/MainWindow_cs/MW_Settings.cs
+++ b/Ink Canvas/MainWindow_cs/MW_Settings.cs
@@ -2177,5 +2177,11 @@ namespace Ink_Canvas {
Settings.Automation.IsAutoFoldAfterPPTSlideShow = ToggleSwitchAutoFoldAfterPPTSlideShow.IsOn;
SaveSettingsToFile();
}
+
+ private void ToggleSwitchAlwaysGoToFirstPageOnReenter_Toggled(object sender, RoutedEventArgs e) {
+ if (!isLoaded) return;
+ Settings.PowerPointSettings.IsAlwaysGoToFirstPageOnReenter = ToggleSwitchAlwaysGoToFirstPageOnReenter.IsOn;
+ SaveSettingsToFile();
+ }
}
}
diff --git a/Ink Canvas/MainWindow_cs/MW_SettingsToLoad.cs b/Ink Canvas/MainWindow_cs/MW_SettingsToLoad.cs
index 41fd11e1..8dea9ac2 100644
--- a/Ink Canvas/MainWindow_cs/MW_SettingsToLoad.cs
+++ b/Ink Canvas/MainWindow_cs/MW_SettingsToLoad.cs
@@ -375,6 +375,7 @@ namespace Ink_Canvas {
ToggleSwitchAutoSaveScreenShotInPowerPoint.IsOn =
Settings.PowerPointSettings.IsAutoSaveScreenShotInPowerPoint;
ToggleSwitchEnableWppProcessKill.IsOn = Settings.PowerPointSettings.EnableWppProcessKill;
+ ToggleSwitchAlwaysGoToFirstPageOnReenter.IsOn = Settings.PowerPointSettings.IsAlwaysGoToFirstPageOnReenter;
} else {
Settings.PowerPointSettings = new PowerPointSettings();
}
diff --git a/Ink Canvas/Resources/Settings.cs b/Ink Canvas/Resources/Settings.cs
index 14f9009c..1c4065f3 100644
--- a/Ink Canvas/Resources/Settings.cs
+++ b/Ink Canvas/Resources/Settings.cs
@@ -239,6 +239,8 @@ namespace Ink_Canvas
public bool IsSupportWPS { get; set; } = true;
[JsonProperty("enableWppProcessKill")]
public bool EnableWppProcessKill { get; set; } = true;
+ [JsonProperty("isAlwaysGoToFirstPageOnReenter")]
+ public bool IsAlwaysGoToFirstPageOnReenter { get; set; } = false;
}
public class Automation