This commit is contained in:
2025-07-21 09:56:51 +08:00
parent f295c85668
commit 44e331ae96
+38
View File
@@ -928,6 +928,11 @@ namespace Ink_Canvas {
currentMode = 0;
}
// 切换前同步保存墨迹
Application.Current.Dispatcher.Invoke(() => {
SaveCurrentSlideInkStrokes();
});
_isPptClickingBtnTurned = true;
// 添加安全检查
@@ -1011,6 +1016,11 @@ namespace Ink_Canvas {
currentMode = 0;
}
// 切换前同步保存墨迹
Application.Current.Dispatcher.Invoke(() => {
SaveCurrentSlideInkStrokes();
});
_isPptClickingBtnTurned = true;
// 添加安全检查
@@ -1214,6 +1224,11 @@ namespace Ink_Canvas {
return;
}
// 切换前同步保存墨迹
Application.Current.Dispatcher.Invoke(() => {
SaveCurrentSlideInkStrokes();
});
try
{
// 检查SlideShowWindows是否存在且有效
@@ -2091,5 +2106,28 @@ namespace Ink_Canvas {
return "error";
}
}
// 新增:同步保存当前页面墨迹的方法
private void SaveCurrentSlideInkStrokes()
{
try
{
if (pptApplication != null && pptApplication.SlideShowWindows != null && pptApplication.SlideShowWindows.Count >= 1)
{
var slideShowWindow = pptApplication.SlideShowWindows[1];
if (slideShowWindow != null && slideShowWindow.View != null)
{
var ms = new MemoryStream();
inkCanvas.Strokes.Save(ms);
ms.Position = 0;
memoryStreams[slideShowWindow.View.CurrentShowPosition] = ms;
}
}
}
catch (Exception ex)
{
LogHelper.WriteLogToFile($"保存当前页面墨迹失败: {ex.ToString()}", LogHelper.LogType.Error);
}
}
}
}