Browse Source

Merge branch 'dev' of http://git.kdan.cc:8865/Windows/PDFOffice_Windows_exe into dev

ZhouJieSheng 1 year ago
parent
commit
12a04241fb
1 changed files with 30 additions and 26 deletions
  1. 30 26
      PDF Office/ViewModels/ViewContentViewModel.cs

+ 30 - 26
PDF Office/ViewModels/ViewContentViewModel.cs

@@ -796,7 +796,6 @@ namespace PDF_Master.ViewModels
 
         public DelegateCommand DownCommand { get; set; }
 
-
         public DelegateCommand PrePageCommand { get; set; }
 
         public DelegateCommand NextPageCommmand { get; set; }
@@ -809,7 +808,6 @@ namespace PDF_Master.ViewModels
 
         public DelegateCommand ZoomOutCommand { get; set; }
 
-
         #endregion 命令
 
         public ViewContentViewModel(IRegionManager regionManager, IDialogService dialogService, IEventAggregator eventAggregator)
@@ -966,7 +964,6 @@ namespace PDF_Master.ViewModels
             bottom?.FirstPageCommand.Execute();
         }
 
-
         /// <summary>
         /// 底部工具栏的缩放至实际大小
         /// </summary>
@@ -1558,16 +1555,7 @@ namespace PDF_Master.ViewModels
             DialogParameters value = new DialogParameters();
             value.Add(ParameterNames.ViewContentViewModel, this);
 
-            AnnotToolContentViewModel annotToolContent = null;
-            if (region.Regions.ContainsRegionWithName(ToolsBarContentRegionName))
-            {
-                var views = region.Regions[ToolsBarContentRegionName].Views;
-                var isHas = views.FindFirst(q => q is AnnotToolContent);
-                if (isHas is AnnotToolContent annotTool)
-                {
-                    annotToolContent = (AnnotToolContentViewModel)annotTool.DataContext;
-                }
-            }
+            AnnotToolContentViewModel annotToolContent = GetAnnotToolContentVM(); ;
 
             dialogs.ShowDialog(DialogNames.SettingsDialog, null, e =>
             {
@@ -1601,6 +1589,21 @@ namespace PDF_Master.ViewModels
             }
         }
 
+        private AnnotToolContentViewModel GetAnnotToolContentVM()
+        {
+            AnnotToolContentViewModel annotToolContent = null;
+            if (region.Regions.ContainsRegionWithName(ToolsBarContentRegionName))
+            {
+                var views = region.Regions[ToolsBarContentRegionName].Views;
+                var isHas = views.FindFirst(q => q is AnnotToolContent);
+                if (isHas is AnnotToolContent annotTool)
+                {
+                    annotToolContent = (AnnotToolContentViewModel)annotTool.DataContext;
+                }
+            }
+            return annotToolContent;
+        }
+
         private void UpdateArrow(AnnotatePropertyClass annotate, AnnotToolContentViewModel annotToolContent)
         {
             Color color2 = annotate.ArrowColor;
@@ -2013,6 +2016,11 @@ namespace PDF_Master.ViewModels
             IsPropertyOpen = false;
             FromClick = false;
 
+            AnnotToolContentViewModel annotToolContent = GetAnnotToolContentVM();
+            if (annotToolContent != null)
+            {
+                annotToolContent.StrAnnotToolChecked = "";
+            }
             if (region.Regions.ContainsRegionWithName(TipContentRegionName))
             {
                 var views = region.Regions[TipContentRegionName].Views;
@@ -2133,14 +2141,12 @@ namespace PDF_Master.ViewModels
                 //判断本地有没有token,没有显示登录,有再判断登录状态
                 if (Settings.Default.AppProperties.LoginToken != "")
                 {
-
                     if (ServiceHelper.GetUser() == "401")
                     {
                         App.mainWindowViewModel.UserVis = Visibility.Collapsed;
                         App.mainWindowViewModel.LoginVis = Visibility.Visible;
                         App.mainWindowViewModel.OphVis = Visibility.Visible;
                     }
-
                 }
                 else
                 {
@@ -2226,24 +2232,23 @@ namespace PDF_Master.ViewModels
                                 annotToolContent.BtnSelecttool.IsChecked = false;
                                 PDFViewer.SetMouseMode(MouseModes.PanTool);
                                 isunannotTool = false;
-
                             }
                         }
-                        else {
-
-                            if (toolContentViewModel!= null)
+                        else
+                        {
+                            if (toolContentViewModel != null)
                             {
-                                if (toolContentViewModel.IsCreateAnnot) {
+                                if (toolContentViewModel.IsCreateAnnot)
+                                {
                                     isunannotTool = false;
-                                    toolContentViewModel.IsCreateAnnot=false;
+                                    toolContentViewModel.IsCreateAnnot = false;
                                 }
-
                             }
                         }
                     }
                 }
 
-                if (mainViewModel.IsBookMode == true&& isunannotTool)
+                if (mainViewModel.IsBookMode == true && isunannotTool)
                 {
                     Off_ReadModel();
                 }
@@ -2384,10 +2389,9 @@ namespace PDF_Master.ViewModels
             }
             PDFViewer.SnapsToDevicePixels = true;
             PDFViewer.UseLayoutRounding = true;
-            RenderOptions.SetBitmapScalingMode(PDFViewer,BitmapScalingMode.Fant);
+            RenderOptions.SetBitmapScalingMode(PDFViewer, BitmapScalingMode.Fant);
             region.AddToRegion(ViwerRegionName, PDFViewer);
 
-
             if (App.mainWindowViewModel != null)
             {
                 //更新CurrentPDFViewer对象
@@ -2807,7 +2811,7 @@ namespace PDF_Master.ViewModels
                 //让保存的效果更明显
                 await Task.Delay(200);
                 //合并前自动保存一次
-                result =  saveFile(true);
+                result = saveFile(true);
                 App.mainWindowViewModel.SetProcessValue(title, 100, 100, false);
             }
             //方便其他调用的地方可以异步 await调用,增加显示保存过程的效果