OYXH\oyxh vor 2 Jahren
Ursprung
Commit
b872acfff9
1 geänderte Dateien mit 18 neuen und 47 gelöschten Zeilen
  1. 18 47
      PDF Office/ViewModels/Tools/AnnotToolContentViewModel.Function.cs

+ 18 - 47
PDF Office/ViewModels/Tools/AnnotToolContentViewModel.Function.cs

@@ -57,7 +57,7 @@ namespace PDF_Office.ViewModels.Tools
         private void InitAnnotHighlight()
         {
             var annotate = Settings.Default.AppProperties.Annotate;
-            if(annotate != null)
+            if (annotate != null)
             {
                 HighLightColor = new SolidColorBrush(annotate.HighLightColor);
                 HighLightOpacity = 1;
@@ -67,7 +67,6 @@ namespace PDF_Office.ViewModels.Tools
                 HighLightColor = new SolidColorBrush(Colors.Red);
                 HighLightOpacity = 1;
             }
-            
         }
 
         private void InitAnnotUnderline()
@@ -83,7 +82,6 @@ namespace PDF_Office.ViewModels.Tools
                 UnderLineColor = new SolidColorBrush(Colors.Red);
                 UnderLineOpacity = 1;
             }
-            
         }
 
         private void InitAnnotSquiggly()
@@ -114,7 +112,6 @@ namespace PDF_Office.ViewModels.Tools
                 StrikeoutColor = new SolidColorBrush(Colors.Red);
                 StrikeoutOpacity = 1;
             }
-
         }
 
         //用来记录选中和创建注释的标识
@@ -229,7 +226,6 @@ namespace PDF_Office.ViewModels.Tools
                     selectedArgs = new List<AnnotHandlerEventArgs>();
                     selectedArgs.Add(highlightArgs);
                 }
-
             }
             else
             {
@@ -248,7 +244,7 @@ namespace PDF_Office.ViewModels.Tools
         {
             LinkAnnotArgs linkArgs = new LinkAnnotArgs();
 
-            if (selectedArgs != null && selectedArgs.Count > 1)
+            if (selectedArgs != null && selectedArgs.Count > 0)
             {
                 linkArgs = selectedArgs[0] as LinkAnnotArgs;
             }
@@ -370,7 +366,7 @@ namespace PDF_Office.ViewModels.Tools
             {
                 freehandArgs = new FreehandAnnotArgs();
                 var annotate = Settings.Default.AppProperties.Annotate;
-                if(annotate != null)
+                if (annotate != null)
                 {
                     freehandArgs.InkColor = annotate.FreeHandColor;
                 }
@@ -410,12 +406,11 @@ namespace PDF_Office.ViewModels.Tools
             if (selectedArgs == null || selectedArgs.Count == 0)
             {
                 freetextArgs = new FreeTextAnnotArgs();
-           
+
                 var annotate = Settings.Default.AppProperties.Annotate;
                 if (annotate != null)
                 {
                     freetextArgs.FontColor = annotate.TextAnnoteColor;
-
                 }
                 else
                 {
@@ -453,7 +448,7 @@ namespace PDF_Office.ViewModels.Tools
                 textAlignment = freetextArgs.Align;
             }
 
-            AddToPropertyPanel("FreetextAnnotProperty", "Freetext", selectedArgs); 
+            AddToPropertyPanel("FreetextAnnotProperty", "Freetext", selectedArgs);
             return freetextArgs;
         }
 
@@ -472,7 +467,6 @@ namespace PDF_Office.ViewModels.Tools
                 if (annotate != null)
                 {
                     stickyAnnotArgs.Color = annotate.NoteAnnoteColor;
-
                 }
                 else
                 {
@@ -572,7 +566,7 @@ namespace PDF_Office.ViewModels.Tools
                 circleAnnotArgs.Transparency = 1;
                 circleAnnotArgs.LineDash = DashStyles.Solid;
                 circleAnnotArgs.Content = string.Empty;
-             
+
                 if (circleAnnotArgs != null)
                 {
                     selectedArgs = new List<AnnotHandlerEventArgs>();
@@ -940,9 +934,8 @@ namespace PDF_Office.ViewModels.Tools
             }
         }
 
-
-
         #region 注释右键菜单事件
+
         //高亮、下划线、删除
         private void HightAnnotCopyText_Menu(object obj)
         {
@@ -950,11 +943,10 @@ namespace PDF_Office.ViewModels.Tools
             {
                 var menu = obj as CusMenuItem;
                 var annot = menu.Parameter as AnnotHandlerEventArgs;
-                if(annot != null)
+                if (annot != null)
                 {
                     System.Windows.Clipboard.SetText(annot.Content);
                 }
-                
             }
         }
 
@@ -972,7 +964,6 @@ namespace PDF_Office.ViewModels.Tools
                         var color = (annot as TextHighlightAnnotArgs).Color;
                         Settings.Default.AppProperties.Annotate.HighLightColor = color;
                         HighLightColor = new SolidColorBrush(color);
-
                     }
                     else if (annot is TextUnderlineAnnotArgs)
                     {
@@ -990,7 +981,6 @@ namespace PDF_Office.ViewModels.Tools
                     {
                         var color = (annot as FreehandAnnotArgs).InkColor;
                         Settings.Default.AppProperties.Annotate.FreeHandColor = color;
-
                     }
                     else if (annot is FreeTextAnnotArgs)
                     {
@@ -1026,8 +1016,6 @@ namespace PDF_Office.ViewModels.Tools
 
                     Settings.Default.Save();
                 }
-               
-              
             }
         }
 
@@ -1050,10 +1038,9 @@ namespace PDF_Office.ViewModels.Tools
                     popup.Placement = System.Windows.Controls.Primitives.PlacementMode.Bottom;
                     popup.IsOpen = true;
                 }
-
             }
         }
-        
+
         private void AnnotMenu_ColorSelected(object sender, Color e)
         {
             if (sender != null)
@@ -1061,13 +1048,13 @@ namespace PDF_Office.ViewModels.Tools
                 var annot = (sender as FrameworkElement).DataContext as AnnotHandlerEventArgs;
                 if (annot != null)
                 {
-                    if(annot is FreehandAnnotArgs || annot is StickyAnnotArgs || annot is LineAnnotArgs)
+                    if (annot is FreehandAnnotArgs || annot is StickyAnnotArgs || annot is LineAnnotArgs)
                     {
                         var AnnotEvent = AnnotAttribEvent.GetAnnotAttribEvent(annot, annot.GetAnnotAttrib());
                         AnnotEvent?.UpdateAttrib(AnnotAttrib.Color, e);
                         AnnotEvent?.UpdateAnnot();
                     }
-                    else if(annot is FreeTextAnnotArgs)
+                    else if (annot is FreeTextAnnotArgs)
                     {
                         var AnnotEvent = AnnotAttribEvent.GetAnnotAttribEvent(annot, annot.GetAnnotAttrib());
                         AnnotEvent?.UpdateAttrib(AnnotAttrib.FontColor, e);
@@ -1079,10 +1066,10 @@ namespace PDF_Office.ViewModels.Tools
                         AnnotEvent?.UpdateAttrib(AnnotAttrib.FillColor, e);
                         AnnotEvent?.UpdateAnnot();
                     }
-
                 }
             }
         }
+
         //添加笔记
         private void AnnotAddNoteText_Menu(object obj)
         {
@@ -1105,15 +1092,12 @@ namespace PDF_Office.ViewModels.Tools
                         }
                     });
                 }
-
             }
-           
         }
 
         //手绘
         private void FreeHandLineStyle_Menu(object obj)
         {
-
             if (obj as CusMenuItem != null)
             {
                 var menu = obj as CusMenuItem;
@@ -1121,7 +1105,7 @@ namespace PDF_Office.ViewModels.Tools
                 if (annot != null)
                 {
                     var AnnotEvent = AnnotAttribEvent.GetAnnotAttribEvent(annot, annot.GetAnnotAttrib());
-                    if(menu.tag.ToString() == "Solid")
+                    if (menu.tag.ToString() == "Solid")
                     {
                         AnnotEvent?.UpdateAttrib(AnnotAttrib.LineStyle, AnnotPropertyPanel.GetLineDashStyle(true));
                     }
@@ -1131,9 +1115,7 @@ namespace PDF_Office.ViewModels.Tools
                     }
 
                     AnnotEvent?.UpdateAnnot();
-
                 }
-
             }
         }
 
@@ -1141,7 +1123,6 @@ namespace PDF_Office.ViewModels.Tools
 
         private void FreeTextFontFamily_Menu(object obj)
         {
-
             if (obj as CusMenuItem != null)
             {
                 var menu = obj as CusMenuItem;
@@ -1152,7 +1133,6 @@ namespace PDF_Office.ViewModels.Tools
                     AnnotEvent?.UpdateAttrib(AnnotAttrib.FontFamily, new FontFamily(menu.tag.ToString()));
                     AnnotEvent?.UpdateAnnot();
                 }
-
             }
         }
 
@@ -1182,9 +1162,7 @@ namespace PDF_Office.ViewModels.Tools
                     }
                     AnnotEvent?.UpdateAnnot();
                 }
-
             }
-
         }
 
         //便签
@@ -1203,11 +1181,13 @@ namespace PDF_Office.ViewModels.Tools
                     annot.Author = Settings.Default.AppProperties.Description.Author;
                     PDFViewer.SetMouseMode(MouseModes.AnnotCreate);
                     PDFViewer.SetToolParam(annot);
+
                     #region 设计重新调整,阅读页空白处,右键菜单,添加链接需要显示,其他和pro mac一样的效果,不显示属性栏
+
                     //isRightMenuAddAnnot = false;
-                    #endregion
-                }
 
+                    #endregion 设计重新调整,阅读页空白处,右键菜单,添加链接需要显示,其他和pro mac一样的效果,不显示属性栏
+                }
             }
         }
 
@@ -1236,9 +1216,7 @@ namespace PDF_Office.ViewModels.Tools
                     }
                     AnnotEvent?.UpdateAnnot();
                 }
-
             }
-
         }
 
         private void ShapeLineDirect_Menu(object obj)
@@ -1261,9 +1239,7 @@ namespace PDF_Office.ViewModels.Tools
                         annot.SetLineHorizontal();
                     }
                 }
-
             }
-            
         }
 
         //图章
@@ -1287,7 +1263,7 @@ namespace PDF_Office.ViewModels.Tools
                     if (dlg.ShowDialog() == true)
                     {
                         var stampPicture = dlg.FileName;
-                        if(menu.tag.ToString() == "PDF")
+                        if (menu.tag.ToString() == "PDF")
                         {
                             var writeStamp = annot.GetStampDrawing();
                             var tempDoc = new CPDFViewer();
@@ -1311,7 +1287,6 @@ namespace PDF_Office.ViewModels.Tools
                             var result = tempDoc.Document.WriteToFilePath(dlg.FileName);
                             if (result)
                             {
-
                             }
                         }
                         else
@@ -1324,17 +1299,13 @@ namespace PDF_Office.ViewModels.Tools
                                 encoder5.Save(stream5);
                             }
                         }
-                        
                     }
                 }
-
             }
         }
-        
 
         #endregion 注释右键菜单事件
 
-
         #endregion 菜单
     }
 }