Browse Source

注释列表-修复筛选

OYXH\oyxh 2 years ago
parent
commit
a241859a73

+ 20 - 18
PDF Office/ViewModels/BOTA/AnnotationContentViewModel.cs

@@ -716,22 +716,22 @@ namespace PDF_Office.ViewModels.BOTA
                         DialogParameters value = new DialogParameters();
                         value.Add(ParameterNames.Annotation, data);
                         dialogs.ShowDialog(DialogNames.AddAnnotationDialog, value, e =>
-                                                                                                                                                          {
-                                                                                                                                                              if (e.Result == ButtonResult.OK && e.Parameters != null)
-                                                                                                                                                              {
-                                                                                                                                                                  //PdfViewer.UndoManager.CanSave = true;
-                                                                                                                                                                  //    if (e.Parameters.ContainsKey(ParameterNames.Annotation) && e.Parameters.ContainsKey(ParameterNames.AnnotEvent))
-                                                                                                                                                                  //    {
-                                                                                                                                                                  //        AnnotationHandlerEventArgs annotation = e.Parameters.GetValue<AnnotationHandlerEventArgs>(ParameterNames.Annotation);
-
-                                                                                                                                                                  //        //AnnotAttribEvent annotEvent = e.Parameters.GetValue<AnnotAttribEvent>(ParameterNames.AnnotEvent);
-
-                                                                                                                                                                  //        //annotEvent?.UpdateAttrib(AnnotAttrib.NoteText, annotation.MarkupContent);
-                                                                                                                                                                  //        //annotEvent?.UpdateAnnot();
-
-                                                                                                                                                                  //    }
-                                                                                                                                                              }
-                                                                                                                                                          });
+                        {
+                            if (e.Result == ButtonResult.OK && e.Parameters != null)
+                            {
+                                //PdfViewer.UndoManager.CanSave = true;
+                                //    if (e.Parameters.ContainsKey(ParameterNames.Annotation) && e.Parameters.ContainsKey(ParameterNames.AnnotEvent))
+                                //    {
+                                //        AnnotationHandlerEventArgs annotation = e.Parameters.GetValue<AnnotationHandlerEventArgs>(ParameterNames.Annotation);
+
+                                //        //AnnotAttribEvent annotEvent = e.Parameters.GetValue<AnnotAttribEvent>(ParameterNames.AnnotEvent);
+
+                                //        //annotEvent?.UpdateAttrib(AnnotAttrib.NoteText, annotation.MarkupContent);
+                                //        //annotEvent?.UpdateAnnot();
+
+                                //    }
+                            }
+                        });
                     }
                     //if(data.EventType == AnnotArgsType.AnnotFreeText)
                     //{
@@ -804,6 +804,7 @@ namespace PDF_Office.ViewModels.BOTA
                         if (AnnotationListItems[k].PageIndex == pageIndex && AnnotationListItems[k].AnnotIndex == annotIndex)
                         {
                             AnnotationListItems.RemoveAt(k);
+                            currentAnnotationArgs.RemoveAt(k);
                             UpdateAnnotListAfterDelete(pageIndex, annotIndex);
                             return;
                         }
@@ -818,6 +819,7 @@ namespace PDF_Office.ViewModels.BOTA
                         if (AnnotationListItems[k].PageIndex == pageIndex && AnnotationListItems[k].AnnotIndex == annotIndex)
                         {
                             AnnotationListItems.RemoveAt(k);
+                            currentAnnotationArgs.RemoveAt(k);
                             UpdateAnnotListAfterDelete(pageIndex, annotIndex);
                             return;
                         }
@@ -1090,8 +1092,8 @@ namespace PDF_Office.ViewModels.BOTA
         {
             if (sender is ObservableCollection<AnnotationHandlerEventArgs> obsSender)
             {
-                currentAnnotationArgs.Clear();
-                currentAnnotationArgs.AddRange(obsSender);
+                //currentAnnotationArgs.Clear();
+                //currentAnnotationArgs.AddRange(obsSender);
                 if (obsSender.Count < 1)
                 {
                     IsEmptyPanelVisibility = Visibility.Visible;

+ 26 - 19
PDF Office/ViewModels/Dialog/BOTA/ScreenAnnotationDialogViewModel.cs

@@ -333,17 +333,20 @@ namespace PDF_Office.ViewModels.Dialog.BOTA
                         case AnnotArgsType.AnnotLine:
                             foreach (var annoitem in AnnotationListItems)
                             {
-                                if ((annoitem.AnnotHandlerEventArgs as LineAnnotArgs).HeadLineType >= (C_LINE_TYPE)1 || (annoitem.AnnotHandlerEventArgs as LineAnnotArgs).TailLineType >= (C_LINE_TYPE)1)
+                                if (annoitem.AnnotHandlerEventArgs is LineAnnotArgs lineAnnotArgs)
                                 {
-                                    //箭头
-                                    SetBtnType(btnSharpArrow, false);
-                                    break;
-                                }
-                                else
-                                {
-                                    //线
-                                    SetBtnType(btnSharpLine, false);
-                                    break;
+                                    if (lineAnnotArgs.HeadLineType >= (C_LINE_TYPE)1 || lineAnnotArgs.TailLineType >= (C_LINE_TYPE)1)
+                                    {
+                                        //箭头
+                                        SetBtnType(btnSharpArrow, false);
+                                        break;
+                                    }
+                                    else
+                                    {
+                                        //线
+                                        SetBtnType(btnSharpLine, false);
+                                        break;
+                                    }
                                 }
                             }
 
@@ -715,17 +718,21 @@ namespace PDF_Office.ViewModels.Dialog.BOTA
                         break;
 
                     case AnnotArgsType.AnnotLine:
-                        if ((item.AnnotHandlerEventArgs as LineAnnotArgs).HeadLineType >= (C_LINE_TYPE)1 || (item.AnnotHandlerEventArgs as LineAnnotArgs).TailLineType >= (C_LINE_TYPE)1)
-                        {
-                            //箭头
-                            SharpArrowVisibility = Visibility.Visible;
-                        }
-                        else
+                        if(data is LineAnnotArgs lineAnnotArgs)
                         {
-                            //线
-                            SharpLineVisibility = Visibility.Visible;
+                            if (lineAnnotArgs.HeadLineType >= (C_LINE_TYPE)1 || lineAnnotArgs.TailLineType >= (C_LINE_TYPE)1)
+                            {
+                                //箭头
+                                SharpArrowVisibility = Visibility.Visible;
+                            }
+                            else
+                            {
+                                //线
+                                SharpLineVisibility = Visibility.Visible;
+                            }
+                            GetAnnotationColors(lineAnnotArgs.LineColor);
                         }
-                        GetAnnotationColors((item.AnnotHandlerEventArgs as LineAnnotArgs).LineColor);
+                       
 
                         break;