add:进入PPT放映自动回到首页 #38
This commit is contained in:
@@ -1584,6 +1584,14 @@
|
||||
FontFamily="Microsoft YaHei UI" FontWeight="Bold"
|
||||
Toggled="ToggleSwitchNotifyPreviousPage_Toggled" />
|
||||
</ui:SimpleStackPanel>
|
||||
<ui:SimpleStackPanel Orientation="Horizontal" HorizontalAlignment="Left">
|
||||
<TextBlock Foreground="#fafafa" Text="进入放映时回到首页" VerticalAlignment="Center"
|
||||
FontSize="14" Margin="0,0,16,0" />
|
||||
<ui:ToggleSwitch OnContent="" OffContent=""
|
||||
Name="ToggleSwitchAlwaysGoToFirstPageOnReenter" IsOn="False"
|
||||
FontFamily="Microsoft YaHei UI" FontWeight="Bold"
|
||||
Toggled="ToggleSwitchAlwaysGoToFirstPageOnReenter_Toggled" />
|
||||
</ui:SimpleStackPanel>
|
||||
<ui:SimpleStackPanel Orientation="Horizontal" HorizontalAlignment="Left">
|
||||
<TextBlock Foreground="#fafafa" Text="提示隐藏幻灯片" VerticalAlignment="Center"
|
||||
FontSize="14" Margin="0,0,16,0" />
|
||||
|
||||
@@ -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;
|
||||
|
||||
@@ -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();
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -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();
|
||||
}
|
||||
|
||||
@@ -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
|
||||
|
||||
Reference in New Issue
Block a user