瀏覽代碼

其他-调整新建文档,使用压缩、合并工具前自动保存逻辑

ZhouJieSheng 1 年之前
父節點
當前提交
9600cd5c1e

+ 1 - 1
PDF Office/ViewModels/BOTA/BOTAContentViewModel.cs

@@ -220,7 +220,7 @@ namespace PDF_Master.ViewModels.BOTA
             {
                 var info = SettingHelper.GetFileInfo(pdfview.Document.FilePath);
                 //避免新文档因打开文件没有selectedTab信息导致崩溃
-                if (info != null&!string.IsNullOrEmpty(info.BOTASelectedTab))
+                if (info != null&&!string.IsNullOrEmpty(info.BOTASelectedTab))
                 {
                     SelectedIndex = info.BOTASelectedInex;
                     EnterSelectedBar(info.BOTASelectedTab);

+ 1 - 1
PDF Office/ViewModels/MainWindowViewModel.cs

@@ -518,7 +518,7 @@ namespace PDF_Master.ViewModels
                 IsProcessVisible = Visibility.Collapsed;
             }
 
-            processCloseBtnVisible = showClose ? Visibility.Visible : Visibility.Collapsed;
+            ProcessCloseBtnVisible = showClose ? Visibility.Visible : Visibility.Collapsed;
         }
 
         public void CloseTabItem(object item)

+ 13 - 6
PDF Office/ViewModels/ViewContentViewModel.cs

@@ -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调用,增加显示保存过程的效果