|
@@ -2233,6 +2233,7 @@ namespace PDF_Master.ViewModels
|
|
|
PDFViewer.SetBackgroundBrush(new System.Windows.Media.SolidColorBrush(Settings.Default.AppProperties.InitialVIew.BackGround));
|
|
|
//设置移动注释参考线
|
|
|
ComPDFKitViewer.CommonDrawData.MovePen = new System.Windows.Media.Pen((System.Windows.Media.Brush)new BrushConverter().ConvertFromString("#1770F4"), 1);
|
|
|
+ ComPDFKitViewer.CommonDrawData.DrawAnnotGuidesLine = true;
|
|
|
//还原上一次关闭前的视图设置
|
|
|
GetOpenFileInfo();
|
|
|
|
|
@@ -2368,11 +2369,11 @@ namespace PDF_Master.ViewModels
|
|
|
/// <summary>
|
|
|
/// 已有路径文档的保存逻辑
|
|
|
/// </summary>
|
|
|
- public bool saveFile()
|
|
|
+ public bool saveFile(bool autosave=false)
|
|
|
{
|
|
|
try
|
|
|
{
|
|
|
- if (string.IsNullOrEmpty(PDFViewer.Document.FilePath) || mainViewModel.NewFile)
|
|
|
+ if ((string.IsNullOrEmpty(PDFViewer.Document.FilePath) || mainViewModel.NewFile)&&!autosave)
|
|
|
return saveAsFile();
|
|
|
|
|
|
//文档已被修复时 提示另存为
|
|
@@ -2466,7 +2467,10 @@ namespace PDF_Master.ViewModels
|
|
|
catch
|
|
|
{
|
|
|
}
|
|
|
- PDFViewer.UndoManager.CanSave = false;
|
|
|
+ if (!autosave)
|
|
|
+ {
|
|
|
+ PDFViewer.UndoManager.CanSave = false;
|
|
|
+ }
|
|
|
SecurityInfo.IsPasswordChanged = false;
|
|
|
}
|
|
|
else
|
|
@@ -2511,14 +2515,17 @@ namespace PDF_Master.ViewModels
|
|
|
bool result = PDFViewer.Document.WriteToLoadedPath();
|
|
|
if (result)
|
|
|
{
|
|
|
- PDFViewer.UndoManager.CanSave = false;
|
|
|
+ if (!autosave)
|
|
|
+ {
|
|
|
+ PDFViewer.UndoManager.CanSave = false;
|
|
|
+ }
|
|
|
App.Current.Dispatcher.Invoke(() =>
|
|
|
{
|
|
|
//保存时更新缩略图
|
|
|
OpenFileInfo info = SettingHelper.GetFileInfo(PDFViewer.Document.FilePath);
|
|
|
try
|
|
|
{
|
|
|
- if (!string.IsNullOrEmpty(info.ThumbImgPath) && !PDFViewer.Document.IsEncrypted)//加密的文档不获取缩略图
|
|
|
+ if (info!=null&&!string.IsNullOrEmpty(info.ThumbImgPath) && !PDFViewer.Document.IsEncrypted)//加密的文档不获取缩略图
|
|
|
{
|
|
|
var size = PDFViewer.Document.GetPageSize(0);
|
|
|
System.Drawing.Bitmap bitmap = ToolMethod.RenderPageBitmapNoWait(PDFViewer.Document, (int)size.Width, (int)size.Height, 0, true, true);
|
|
@@ -2656,7 +2663,7 @@ namespace PDF_Master.ViewModels
|
|
|
//让保存的效果更明显
|
|
|
await Task.Delay(200);
|
|
|
//合并前自动保存一次
|
|
|
- saveFile();
|
|
|
+ saveFile(true);
|
|
|
App.mainWindowViewModel.SetProcessValue(title, 100, 100, false);
|
|
|
}
|
|
|
//方便其他调用的地方可以异步 await调用,增加显示保存过程的效果
|