fix:PPT上次页数记忆跳转

This commit is contained in:
2025-10-18 16:41:55 +08:00
parent a889041896
commit a1fccc2905
2 changed files with 34 additions and 6 deletions
+12 -1
View File
@@ -678,15 +678,26 @@ namespace Ink_Canvas.Helpers
{
try
{
if (!IsConnected || !IsInSlideShow || PPTApplication == null) return false;
if (!IsConnected || PPTApplication == null) return false;
if (!Marshal.IsComObject(PPTApplication)) return false;
if (IsInSlideShow && PPTApplication.SlideShowWindows.Count >= 1)
{
var slideShowWindow = PPTApplication.SlideShowWindows[1];
if (slideShowWindow?.View != null)
{
slideShowWindow.View.GotoSlide(slideNumber);
return true;
}
}
else if (CurrentPresentation != null)
{
if (CurrentPresentation.Windows?.Count >= 1)
{
CurrentPresentation.Windows[1].View.GotoSlide(slideNumber);
return true;
}
}
return false;
}
catch (COMException comEx)
+18 -1
View File
@@ -960,7 +960,24 @@ namespace Ink_Canvas
_lastPlaybackPage = page;
new YesOrNoNotificationWindow($"上次播放到了第 {page} 页, 是否立即跳转", () =>
{
_shouldNavigateToLastPage = true;
try
{
if (_pptManager?.PPTApplication != null)
{
if (_pptManager.PPTApplication.SlideShowWindows.Count >= 1)
{
pres.SlideShowWindow.View.GotoSlide(page);
}
else
{
pres.Windows[1].View.GotoSlide(page);
}
}
}
catch (Exception ex)
{
LogHelper.WriteLogToFile($"跳转到第{page}页失败: {ex}", LogHelper.LogType.Error);
}
}).ShowDialog();
}
}