Jelajahi Sumber

注释列表同步选中

OYXH\oyxh 1 tahun lalu
induk
melakukan
550e7716fa

+ 38 - 25
PDF Office/ViewModels/Tools/AnnotToolContentViewModel.Command.cs

@@ -431,6 +431,9 @@ namespace PDF_Master.ViewModels.Tools
                             {
                                 StrAnnotToolChecked = "";
                             }
+
+                            //注释列表同步选中
+                            SelectedBotaAnnotationList(e);
                         }
                         else
                         {
@@ -537,28 +540,6 @@ namespace PDF_Master.ViewModels.Tools
                             GetSelectedAnnots(e);
                     }
                 }
-
-                //注释列表同步选中
-                var list = e.GetPageAnnotsIndex();
-                bool isTabItemAnnotation = IsBOTATabItemShow(out BOTAContentViewModel bOTAContentViewModel, out BOTAContent bOTAContent, "TabItemAnnotation");
-
-                if (viewContentViewModel.OpenBOTA == true && isTabItemAnnotation == true && bOTAContent.TabItemAnnotation.IsSelected == true && list != null && list.Count > 0)
-                {
-                    if (list.Keys.Count == 0)
-                    {
-                        return;
-                    }
-                    var pageindex = new List<int>(list.Keys);
-                    List<int> annotes = new List<int>();
-                    list.TryGetValue(pageindex[0], out annotes);
-                    int annoteindex = annotes[0];
-                    AnnotationContentViewModel viewModel = GetAnnotationContentViewModel(bOTAContentViewModel, out AnnotationContent annotation);
-
-                    if (viewModel != null)
-                    {
-                        viewModel.ScrollToAnnot(pageindex[0], annoteindex, annotation.AnnotationList);
-                    }
-                }
             }
             //else
             //{
@@ -577,9 +558,41 @@ namespace PDF_Master.ViewModels.Tools
             //    viewContentViewModel.SelectedPrpoertyPanel("PropertyPanelContent", null);
             //}
             //}
-        }
-
-        //在注释工具的状态下,右键菜单
+        }
+
+        /// <summary>
+        /// 注释列表同步选中
+        /// </summary>
+        /// <param name="e"></param>
+        private void SelectedBotaAnnotationList(AnnotAttribEvent e)
+        {
+            var list = e.GetPageAnnotsIndex();
+            bool isTabItemAnnotation = IsBOTATabItemShow(out BOTAContentViewModel bOTAContentViewModel, out BOTAContent bOTAContent, "TabItemAnnotation");
+            if (viewContentViewModel.OpenBOTA == false || isTabItemAnnotation == false || bOTAContent.TabItemAnnotation.IsSelected == false)
+            {
+                viewContentViewModel.OpenBOTA = true;
+                bOTAContent.TabItemAnnotation.IsSelected = true;
+            }
+            if (viewContentViewModel.OpenBOTA == true && isTabItemAnnotation == true && bOTAContent.TabItemAnnotation.IsSelected == true && list != null && list.Count > 0)
+            {
+                if (list.Keys.Count == 0)
+                {
+                    return;
+                }
+                var pageindex = new List<int>(list.Keys);
+                List<int> annotes = new List<int>();
+                list.TryGetValue(pageindex[0], out annotes);
+                int annoteindex = annotes[0];
+                AnnotationContentViewModel viewModel = GetAnnotationContentViewModel(bOTAContentViewModel, out AnnotationContent annotation);
+
+                if (viewModel != null)
+                {
+                    viewModel.ScrollToAnnot(pageindex[0], annoteindex, annotation.AnnotationList);
+                }
+            }
+        }
+
+        //在注释工具的状态下,右键菜单
         private void PDFViewer_AnnotCommandHandler(object sender, AnnotCommandArgs e)
         {
             if (e.AnnotEventArgsList == null || (PDFViewer != null && PDFViewer.MouseMode == MouseModes.FormEditTool))