Browse Source

注释-UI线程排查

OYXH\oyxh 1 year ago
parent
commit
e440c998f1
1 changed files with 76 additions and 76 deletions
  1. 76 76
      PDF Office/ViewModels/Tools/AnnotToolContentViewModel.Command.cs

+ 76 - 76
PDF Office/ViewModels/Tools/AnnotToolContentViewModel.Command.cs

@@ -377,15 +377,14 @@ namespace PDF_Master.ViewModels.Tools
                 PropertyPanel.AnnotEvents = null;
                 PropertyPanel.AnnotEvent = null;
                 PropertyPanel.annotlists = null;
+                //PDFViewer.SetMouseMode(MouseModes.PanTool);
+                //HandToolIsCheckedEvent(false);
                 if (string.IsNullOrWhiteSpace(StrAnnotToolChecked))
                 {
-                    
                     viewContentViewModel.SelectedPrpoertyPanel("PropertyPanelContent", null);
-                    
                 }
                 else
                 {
-                    
                     if (StrAnnotToolChecked != "Stamp" && StrAnnotToolChecked != "Freetext")
                     {
                         AnnotHandlerEventArgs annotArgs = null;
@@ -450,10 +449,10 @@ namespace PDF_Master.ViewModels.Tools
                                 PropertyPanel.AnnotEvents = null;
                                 PropertyPanel.AnnotEvent = null;
                                 PropertyPanel.annotlists = null;
-                                ExitAnnotationTool();
+                                PDFViewer.SetMouseMode(MouseModes.PanTool);
+                                HandToolIsCheckedEvent(false);
                                 viewContentViewModel.SelectedPrpoertyPanel("PropertyPanelContent", null);
                             }
-                            
 
                             //switch (annot.EventType)
                             //{
@@ -1238,98 +1237,99 @@ namespace PDF_Master.ViewModels.Tools
                 AnnotHandlerEventArgs annotArgs = null;
                 //PropertyPanel.SaveLastAnnot();
                 List<AnnotHandlerEventArgs> annots = new List<AnnotHandlerEventArgs>();
-                if (PropertyPanel.annot != null)
+
+                foreach (AnnotArgsType argsType in e.Keys)
                 {
-                    foreach (AnnotArgsType argsType in e.Keys)
+                    if (PropertyPanel.annot != null)
                     {
                         if (PropertyPanel.annot.EventType != argsType)
                         {
                             PDFViewer.SetMouseMode(MouseModes.PanTool);
                         }
-                        switch (argsType)
-                        {
-                            case AnnotArgsType.AnnotSquare:
-                                if (CurrentSelectedAnnot != null)
-                                {
-                                    if (CurrentSelectedAnnot.EventType == AnnotArgsType.AnnotSquare)
-                                        annots.Add(CurrentSelectedAnnot);
-                                }
-                                if (annots.Count > 0)
-                                {
-                                    annotArgs = GetRect(annots);
-                                }
-                                else
-                                {
-                                    annotArgs = GetRect();
-                                }
+                    }
+                    switch (argsType)
+                    {
+                        case AnnotArgsType.AnnotSquare:
+                            if (CurrentSelectedAnnot != null)
+                            {
+                                if (CurrentSelectedAnnot.EventType == AnnotArgsType.AnnotSquare)
+                                    annots.Add(CurrentSelectedAnnot);
+                            }
+                            if (annots.Count > 0)
+                            {
+                                annotArgs = GetRect(annots);
+                            }
+                            else
+                            {
+                                annotArgs = GetRect();
+                            }
 
-                                break;
+                            break;
 
-                            case AnnotArgsType.AnnotCircle:
-                                if (CurrentSelectedAnnot != null)
-                                {
-                                    if (CurrentSelectedAnnot.EventType == AnnotArgsType.AnnotCircle)
-                                        annots.Add(CurrentSelectedAnnot);
-                                }
-                                if (annots.Count > 0)
-                                {
-                                    annotArgs = GetCircle(annots);
-                                }
-                                else
-                                {
-                                    annotArgs = GetCircle();
-                                }
+                        case AnnotArgsType.AnnotCircle:
+                            if (CurrentSelectedAnnot != null)
+                            {
+                                if (CurrentSelectedAnnot.EventType == AnnotArgsType.AnnotCircle)
+                                    annots.Add(CurrentSelectedAnnot);
+                            }
+                            if (annots.Count > 0)
+                            {
+                                annotArgs = GetCircle(annots);
+                            }
+                            else
+                            {
+                                annotArgs = GetCircle();
+                            }
 
-                                break;
+                            break;
 
-                            case AnnotArgsType.AnnotLine:
-                                var LineTag = e[argsType] as string;
-                                if (CurrentSelectedAnnot != null)
+                        case AnnotArgsType.AnnotLine:
+                            var LineTag = e[argsType] as string;
+                            if (CurrentSelectedAnnot != null)
+                            {
+                                if (CurrentSelectedAnnot.EventType == AnnotArgsType.AnnotLine)
                                 {
-                                    if (CurrentSelectedAnnot.EventType == AnnotArgsType.AnnotLine)
+                                    if (CurrentSelectedAnnot is LineAnnotArgs lineAnnotArgs)
                                     {
-                                        if (CurrentSelectedAnnot is LineAnnotArgs lineAnnotArgs)
+                                        if (lineAnnotArgs.HeadLineType >= (C_LINE_TYPE)1 || lineAnnotArgs.TailLineType >= (C_LINE_TYPE)1)
                                         {
-                                            if (lineAnnotArgs.HeadLineType >= (C_LINE_TYPE)1 || lineAnnotArgs.TailLineType >= (C_LINE_TYPE)1)
+                                            if (LineTag == "Arrow")
                                             {
-                                                if (LineTag == "Arrow")
-                                                {
-                                                    annots.Add(CurrentSelectedAnnot);
-                                                }
+                                                annots.Add(CurrentSelectedAnnot);
                                             }
-                                            else
+                                        }
+                                        else
+                                        {
+                                            if (LineTag == "Line")
                                             {
-                                                if (LineTag == "Line")
-                                                {
-                                                    annots.Add(CurrentSelectedAnnot);
-                                                }
+                                                annots.Add(CurrentSelectedAnnot);
                                             }
                                         }
                                     }
                                 }
-                                if (annots.Count > 0)
-                                {
-                                    annotArgs = GetArrowLine(LineTag, annots);
-                                }
-                                else
-                                {
-                                    annotArgs = GetArrowLine(LineTag);
-                                }
+                            }
+                            if (annots.Count > 0)
+                            {
+                                annotArgs = GetArrowLine(LineTag, annots);
+                            }
+                            else
+                            {
+                                annotArgs = GetArrowLine(LineTag);
+                            }
 
-                                break;
-                        }
-                        ShowPropertyPanel();
-                        if (string.IsNullOrEmpty(StrAnnotToolChecked) || StrAnnotToolChecked != "Rect")
-                        {
-                            PDFViewer.SetMouseMode(MouseModes.PanTool);
-                            return;
-                        }
-                        if (annotArgs != null)
-                        {
-                            annotArgs.Author = Settings.Default.AppProperties.Description.Author;
-                            PDFViewer.SetMouseMode(MouseModes.AnnotCreate);
-                            PDFViewer.SetToolParam(annotArgs);
-                        }
+                            break;
+                    }
+                    ShowPropertyPanel();
+                    if (string.IsNullOrEmpty(StrAnnotToolChecked) || StrAnnotToolChecked != "Rect")
+                    {
+                        PDFViewer.SetMouseMode(MouseModes.PanTool);
+                        return;
+                    }
+                    if (annotArgs != null)
+                    {
+                        annotArgs.Author = Settings.Default.AppProperties.Description.Author;
+                        PDFViewer.SetMouseMode(MouseModes.AnnotCreate);
+                        PDFViewer.SetToolParam(annotArgs);
                     }
                 }
             }