Bladeren bron

注释工具 - 优化注释代码

chenrongqian@kdanmobile.com 1 jaar geleden
bovenliggende
commit
adb67c5586

+ 1 - 0
PDF Office/PDF Office.csproj

@@ -605,6 +605,7 @@
     <Compile Include="ViewModels\TipContent\LinkAnnotTipViewModel.cs" />
     <Compile Include="ViewModels\TipContent\RemoveSecuritySuccessTipViewModel.cs" />
     <Compile Include="ViewModels\TipContent\SetPasswordSuccessfullyTipViewModel.cs" />
+    <Compile Include="ViewModels\Tools\AnnotManager\AnnotPanel.cs" />
     <Compile Include="ViewModels\Tools\AnnotToolContentViewModel.Command.cs" />
     <Compile Include="ViewModels\Tools\AnnotToolContentViewModel.Layout.cs" />
     <Compile Include="ViewModels\Tools\ConverterBarContentViewModel.cs" />

+ 4 - 3
PDF Office/ViewModels/FillAndSign/FillAndSignContentViewModel.cs

@@ -52,6 +52,7 @@ using Task = System.Threading.Tasks.Task;
 using Size = System.Windows.Size;
 using System.Windows.Markup;
 using Prism.Services.Dialogs;
+using PDF_Office.ViewModels.Tools.AnnotManager;
 
 namespace PDF_Office.ViewModels.FillAndSign
 {
@@ -59,7 +60,7 @@ namespace PDF_Office.ViewModels.FillAndSign
     {
         #region 
         public CPDFViewer PDFViewer;
-        private AnnotPropertyPanel propertyPanel = new AnnotPropertyPanel();
+        private AnnotTransfer propertyPanel = new AnnotTransfer();
         private ViewContentViewModel viewContentViewModel;
         private bool isRightMenuAddAnnot = false;
         private IEventAggregator events;
@@ -341,7 +342,7 @@ namespace PDF_Office.ViewModels.FillAndSign
                         FreehandDefault.Opacity = freeHand.Transparency;
                         FreehandDefault.Thickness = freeHand.LineWidth;
                         FreehandDefault.SaveKey = "FillAndSign";
-                        var isSolid = AnnotPropertyPanel.IsSolidStyle(freeHand.LineDash);
+                        var isSolid = AnnotTransfer.IsSolidStyle(freeHand.LineDash);
                         if (isSolid)
                         {
                             FreehandDefault.DashArray = null;
@@ -908,7 +909,7 @@ namespace PDF_Office.ViewModels.FillAndSign
 
         }
 
-        private void NavigateToProperty(string btnName, AnnotPropertyPanel annotPropertyPanel)
+        private void NavigateToProperty(string btnName, AnnotTransfer annotPropertyPanel)
         {
             NavigationParameters values = new NavigationParameters();
             values.Add(ParameterNames.PDFViewer, PDFViewer);

+ 3 - 2
PDF Office/ViewModels/FillAndSign/PropertyPanel/ShapFillPropertyViewModel.cs

@@ -21,6 +21,7 @@ using Point = System.Windows.Point;
 using static Dropbox.Api.UsersCommon.AccountType;
 using PDF_Office.Model.AnnotPanel;
 using PDFSettings;
+using PDF_Office.ViewModels.Tools.AnnotManager;
 
 namespace PDF_Office.ViewModels.FillAndSign.PropertyPanel
 {
@@ -28,7 +29,7 @@ namespace PDF_Office.ViewModels.FillAndSign.PropertyPanel
     {
         public AnnotAttribEvent AnnotEvent { get; set; }
         private AnnotHandlerEventArgs Annot;
-        private AnnotPropertyPanel PropertyPanel;
+        private AnnotTransfer PropertyPanel;
         private FillAndSignContentViewModel fillAndSignContentViewModel;
         public List<List<Point>> updatapath = new List<List<Point>>();
         private Geometry dataPath = null;
@@ -419,7 +420,7 @@ namespace PDF_Office.ViewModels.FillAndSign.PropertyPanel
         public void OnNavigatedTo(NavigationContext navigationContext)
         {
             string shape = "";
-            navigationContext.Parameters.TryGetValue<AnnotPropertyPanel>(ParameterNames.PropertyPanelContentViewModel, out PropertyPanel);
+            navigationContext.Parameters.TryGetValue<AnnotTransfer>(ParameterNames.PropertyPanelContentViewModel, out PropertyPanel);
             navigationContext.Parameters.TryGetValue<FillAndSignContentViewModel>("FillAndSignContentViewModel", out fillAndSignContentViewModel);
             navigationContext.Parameters.TryGetValue<string>("Shape", out shape);
             InitSharpsType(shape);

+ 3 - 2
PDF Office/ViewModels/PropertyPanel/AnnotPanel/FreehandAnnotPropertyViewModel.cs

@@ -6,6 +6,7 @@ using PDF_Office.Model;
 using PDF_Office.Model.AnnotPanel;
 using PDF_Office.Model.PropertyPanel.AnnotPanel;
 using PDF_Office.ViewModels.Tools;
+using PDF_Office.ViewModels.Tools.AnnotManager;
 using PDFSettings;
 using Prism.Commands;
 using Prism.Mvvm;
@@ -89,7 +90,7 @@ namespace PDF_Office.ViewModels.PropertyPanel.AnnotPanel
 
         public AnnotAttribEvent AnnotEvent { get; set; }
         private AnnotHandlerEventArgs Annot;
-        private AnnotPropertyPanel PropertyPanel;
+        private AnnotTransfer PropertyPanel;
         public DelegateCommand<object> EraseCommand { get; set; }
         public DelegateCommand<object> PenCommand { get; set; }
 
@@ -288,7 +289,7 @@ namespace PDF_Office.ViewModels.PropertyPanel.AnnotPanel
 
         public void OnNavigatedTo(NavigationContext navigationContext)
         {
-            navigationContext.Parameters.TryGetValue<AnnotPropertyPanel>(ParameterNames.PropertyPanelContentViewModel, out PropertyPanel);
+            navigationContext.Parameters.TryGetValue<AnnotTransfer>(ParameterNames.PropertyPanelContentViewModel, out PropertyPanel);
 
             if (PropertyPanel != null)
             {

+ 3 - 2
PDF Office/ViewModels/PropertyPanel/AnnotPanel/FreetextAnnotPropertyViewModel.cs

@@ -5,6 +5,7 @@ using PDF_Office.Model;
 using PDF_Office.Model.AnnotPanel;
 using PDF_Office.Model.PropertyPanel.AnnotPanel;
 using PDF_Office.ViewModels.Tools;
+using PDF_Office.ViewModels.Tools.AnnotManager;
 using PDFSettings;
 using Prism.Commands;
 using Prism.Mvvm;
@@ -107,7 +108,7 @@ namespace PDF_Office.ViewModels.PropertyPanel.AnnotPanel
 
         public AnnotAttribEvent AnnotEvent { get; set; }
         private FreeTextAnnotArgs Annot;
-        private AnnotPropertyPanel PropertyPanel;
+        private AnnotTransfer PropertyPanel;
 
         public DelegateCommand SelectedPresetFontCommand { get; set; }
         public DelegateCommand FontFamilyChangedCommand { get; set; }
@@ -493,7 +494,7 @@ namespace PDF_Office.ViewModels.PropertyPanel.AnnotPanel
 
         public void OnNavigatedTo(NavigationContext navigationContext)
         {
-            navigationContext.Parameters.TryGetValue<AnnotPropertyPanel>(ParameterNames.PropertyPanelContentViewModel, out PropertyPanel);
+            navigationContext.Parameters.TryGetValue<AnnotTransfer>(ParameterNames.PropertyPanelContentViewModel, out PropertyPanel);
             if (PropertyPanel != null)
             {
                

+ 3 - 2
PDF Office/ViewModels/PropertyPanel/AnnotPanel/LinkAnnotPropertyViewModel.cs

@@ -34,6 +34,7 @@ using Prism.Events;
 using Prism.Services.Dialogs;
 using PDF_Office.Views.BOTA;
 using ImTools;
+using PDF_Office.ViewModels.Tools.AnnotManager;
 
 namespace PDF_Office.ViewModels.PropertyPanel.AnnotPanel
 {
@@ -473,7 +474,7 @@ namespace PDF_Office.ViewModels.PropertyPanel.AnnotPanel
         private CPDFDocument document;
         private Button btnGOorBack = null;
         private LinkAnnotProperty linkAnnot;
-        private AnnotPropertyPanel propertyPanel;
+        private AnnotTransfer propertyPanel;
         private ViewContentViewModel viewContentViewModel;
 
         public IRegionManager region;
@@ -1151,7 +1152,7 @@ namespace PDF_Office.ViewModels.PropertyPanel.AnnotPanel
 
         public void OnNavigatedTo(NavigationContext navigationContext)
         {
-            navigationContext.Parameters.TryGetValue<AnnotPropertyPanel>(ParameterNames.PropertyPanelContentViewModel, out propertyPanel);
+            navigationContext.Parameters.TryGetValue<AnnotTransfer>(ParameterNames.PropertyPanelContentViewModel, out propertyPanel);
             navigationContext.Parameters.TryGetValue<CPDFViewer>(ParameterNames.PDFViewer, out pdfViewer);
             navigationContext.Parameters.TryGetValue<ViewContentViewModel>(ParameterNames.ViewContentViewModel, out viewContentViewModel);
 

+ 6 - 5
PDF Office/ViewModels/PropertyPanel/AnnotPanel/SharpsAnnotPropertyViewModel.cs

@@ -6,6 +6,7 @@ using PDF_Office.Helper;
 using PDF_Office.Model;
 using PDF_Office.Model.AnnotPanel;
 using PDF_Office.ViewModels.Tools;
+using PDF_Office.ViewModels.Tools.AnnotManager;
 using PDFSettings;
 using Prism.Commands;
 using Prism.Mvvm;
@@ -379,10 +380,10 @@ namespace PDF_Office.ViewModels.PropertyPanel.AnnotPanel
 
         public AnnotAttribEvent AnnotEvent { get; set; }
         private AnnotHandlerEventArgs Annot;
-        private AnnotPropertyPanel PropertyPanel;
+        private AnnotTransfer PropertyPanel;
         public void OnNavigatedTo(NavigationContext navigationContext)
         {
-            navigationContext.Parameters.TryGetValue<AnnotPropertyPanel>(ParameterNames.PropertyPanelContentViewModel, out PropertyPanel);
+            navigationContext.Parameters.TryGetValue<AnnotTransfer>(ParameterNames.PropertyPanelContentViewModel, out PropertyPanel);
             if (PropertyPanel != null)
             {
                 AnnotEvent = PropertyPanel.AnnotEvent;
@@ -517,17 +518,17 @@ namespace PDF_Office.ViewModels.PropertyPanel.AnnotPanel
             if (annot is SquareAnnotArgs)
             {
                 var Square = Annot as SquareAnnotArgs;
-                isSolid = AnnotPropertyPanel.IsSolidStyle(Square.LineDash);
+                isSolid = AnnotTransfer.IsSolidStyle(Square.LineDash);
             }
             else if (annot is CircleAnnotArgs)
             {
                 var Circle = Annot as CircleAnnotArgs;
-                isSolid = AnnotPropertyPanel.IsSolidStyle(Circle.LineDash);
+                isSolid = AnnotTransfer.IsSolidStyle(Circle.LineDash);
             }
             else if (annot is LineAnnotArgs)
             {
                 var line = Annot as LineAnnotArgs;
-                isSolid = AnnotPropertyPanel.IsSolidStyle(line.LineDash);
+                isSolid = AnnotTransfer.IsSolidStyle(line.LineDash);
             }
 
             return isSolid;

+ 13 - 0
PDF Office/ViewModels/PropertyPanel/AnnotPanel/StickyNotePopupViewModel.cs

@@ -82,6 +82,10 @@ namespace PDF_Office.ViewModels.PropertyPanel.AnnotPanel
 
         public void OnNavigatedFrom(NavigationContext navigationContext)
         {
+            if(StickyAnnotArgs != null && string.IsNullOrEmpty(StickyAnnotArgs.Content))
+            {
+                PDFViewer.RemovePageAnnot(StickyAnnotArgs.PageIndex, StickyAnnotArgs.AnnotIndex);
+            }
         }
 
         public void OnNavigatedTo(NavigationContext navigationContext)
@@ -90,8 +94,17 @@ namespace PDF_Office.ViewModels.PropertyPanel.AnnotPanel
             navigationContext.Parameters.TryGetValue<StickyAnnotArgs>(ParameterNames.StickyAnnotArgs, out StickyAnnotArgs);
             navigationContext.Parameters.TryGetValue<AnnotCommandArgs>(ParameterNames.AnnotCommandArgs, out AnnotCommandArgs);
             navigationContext.Parameters.TryGetValue<CPDFViewer>(ParameterNames.PDFViewer, out PDFViewer);
+            SetToolParam();
             AuthorText = Settings.Default.AppProperties.Description.Author;
             DateText = DateTime.Now.ToString("MM/dd/yyyy  hh:mm:ss");
         }
+
+        private void SetToolParam()
+        {
+            if(PDFViewer != null && StickyAnnotArgs != null && string.IsNullOrEmpty(StickyAnnotArgs.Content))
+            {
+                PDFViewer.SetToolParam(StickyAnnotArgs);
+            }
+        }
     }
 }

+ 3 - 2
PDF Office/ViewModels/PropertyPanel/AnnotPanel/StickyNotePropertyViewModel.cs

@@ -4,6 +4,7 @@ using PDF_Office.CustomControl.CompositeControl;
 using PDF_Office.Model;
 using PDF_Office.Model.AnnotPanel;
 using PDF_Office.ViewModels.Tools;
+using PDF_Office.ViewModels.Tools.AnnotManager;
 using PDFSettings;
 using Prism.Commands;
 using Prism.Mvvm;
@@ -173,10 +174,10 @@ namespace PDF_Office.ViewModels.PropertyPanel.AnnotPanel
 
         public AnnotAttribEvent AnnotEvent { get; set; }
         private AnnotHandlerEventArgs Annot;
-        private AnnotPropertyPanel PropertyPanel;
+        private AnnotTransfer PropertyPanel;
         public void OnNavigatedTo(NavigationContext navigationContext)
         {
-            navigationContext.Parameters.TryGetValue<AnnotPropertyPanel>(ParameterNames.PropertyPanelContentViewModel, out PropertyPanel);
+            navigationContext.Parameters.TryGetValue<AnnotTransfer>(ParameterNames.PropertyPanelContentViewModel, out PropertyPanel);
             if (PropertyPanel != null)
             {
                 AnnotEvent = PropertyPanel.AnnotEvent;

+ 3 - 2
PDF Office/ViewModels/PropertyPanel/AnnotPanel/TextAnnotPropertyViewModel.cs

@@ -5,6 +5,7 @@ using PDF_Office.Model;
 using PDF_Office.Model.AnnotPanel;
 using PDF_Office.Properties;
 using PDF_Office.ViewModels.Tools;
+using PDF_Office.ViewModels.Tools.AnnotManager;
 using PDFSettings;
 using Prism.Commands;
 using Prism.Mvvm;
@@ -87,7 +88,7 @@ namespace PDF_Office.ViewModels.PropertyPanel.AnnotPanel
 
         public AnnotAttribEvent AnnotEvent { get; set; }
         private AnnotHandlerEventArgs Annot;
-        private AnnotPropertyPanel PropertyPanel;
+        private AnnotTransfer PropertyPanel;
         public DelegateCommand<object> SelectedColorChangedCommand { get; set; }
         public DelegateCommand<object> SelectedOpacityChangedCommand { get; set; }
 
@@ -185,7 +186,7 @@ namespace PDF_Office.ViewModels.PropertyPanel.AnnotPanel
         public void OnNavigatedTo(NavigationContext navigationContext)
         {
 
-            navigationContext.Parameters.TryGetValue<AnnotPropertyPanel>(ParameterNames.PropertyPanelContentViewModel, out PropertyPanel);
+            navigationContext.Parameters.TryGetValue<AnnotTransfer>(ParameterNames.PropertyPanelContentViewModel, out PropertyPanel);
             if(PropertyPanel != null)
             {
                 AllVariable();

+ 151 - 0
PDF Office/ViewModels/Tools/AnnotManager/AnnotPanel.cs

@@ -0,0 +1,151 @@
+using ComPDFKitViewer;
+using ComPDFKitViewer.AnnotEvent;
+using System;
+using System.Collections.Generic;
+using System.Linq;
+using System.Text;
+using System.Threading.Tasks;
+using System.Windows.Media;
+
+namespace PDF_Office.ViewModels.Tools.AnnotManager
+{
+    /// <summary>
+    /// 注释面板与外部(如注释工具)关联
+    /// </summary>
+    public class AnnotTransfer
+    {
+        public bool IsAddLink = false;
+        public bool IsLocationLink = false;
+        public AnnotAttribEvent AnnotEvent { get; set; }
+        public List<AnnotAttribEvent> AnnotEvents = new List<AnnotAttribEvent>();
+
+        public AnnotHandlerEventArgs annot;
+        public List<AnnotHandlerEventArgs> annotlists;
+
+        public bool IsTextFill { get; private set; }
+
+        public void SetIsTextFill(bool isTextFill)
+        {
+            IsTextFill = isTextFill;
+        }
+
+        public event EventHandler<Dictionary<AnnotArgsType, object>> DataChanged;
+
+        public event EventHandler<Dictionary<AnnotArgsType, object>> AnnotTypeChanged;
+
+        public event EventHandler<object> DefaultStored;
+
+        public AnnotTransfer()
+        { 
+        
+        }
+
+        //外部UI控件选中状态
+        public static bool IsSolidStyle(DashStyle LineDash)
+        {
+            bool isSolid = true;
+            if (LineDash == null || LineDash.Dashes.Count == 0)
+            {
+                return isSolid;
+            }
+
+            foreach (var item in LineDash.Dashes)
+            {
+                if (item > 0)
+                {
+                    isSolid = false;
+                    break;
+                }
+            }
+            return isSolid;
+        }
+
+        public static DashStyle GetLineDashStyle(bool isSolid)
+        {
+            DashStyle newDash = new DashStyle();
+            if (isSolid == false)
+            {
+                newDash.Dashes.Add(2);
+                newDash.Dashes.Add(2);
+            }
+            else
+            {
+                newDash = DashStyles.Solid;
+            }
+
+            return newDash;
+        }
+
+        //单个属性更改
+        public void UpdateAnnotAAttrib(AnnotAttrib annotAttrib, object obj)
+        {
+            if (annotlists != null && annotlists.Count > 1)
+            {
+                foreach (var itemevent in AnnotEvents)
+                {
+                    itemevent?.UpdateAttrib(annotAttrib, obj);
+                    itemevent?.UpdateAnnot();
+                }
+            }
+            else
+            {
+                AnnotEvent?.UpdateAttrib(annotAttrib, obj);
+                AnnotEvent?.UpdateAnnot();
+            }
+        }
+
+        //多个属性更改
+        public void UpdateAnnotAllAttribs(Dictionary<AnnotAttrib, object> AnnotAttribDir)
+        {
+            if (annotlists != null && annotlists.Count > 1)
+            {
+                foreach (var itemevent in AnnotEvents)
+                {
+                    foreach (var item in AnnotAttribDir)
+                    {
+                        itemevent?.UpdateAttrib(item.Key, item.Value);
+                    }
+
+                    itemevent?.UpdateAnnot();
+                }
+            }
+            else
+            {
+                foreach (var item in AnnotAttribDir)
+                {
+                    AnnotEvent?.UpdateAttrib(item.Key, item.Value);
+                }
+
+                AnnotEvent?.UpdateAnnot();
+            }
+        }
+
+        //是否为多选
+        public bool IsMultiSelected
+        { get { return (annotlists != null && annotlists.Count > 1); } }
+
+        /// <summary>
+        /// 更新多个属性,触发到工具栏注释工具,改变工具图标下的颜色值
+        /// </summary>
+        public void InvokeToMyTools(object sender, Dictionary<AnnotArgsType, object> keyValues)
+        {
+            DataChanged?.Invoke(sender, keyValues);
+        }
+
+        /// <summary>
+        /// 更新单个属性
+        /// </summary>
+        public void InvokeToMyTools(AnnotArgsType argsType, object obj)
+        {
+            Dictionary<AnnotArgsType, object> changeData = new Dictionary<AnnotArgsType, object>();
+            changeData[argsType] = obj;
+            DataChanged?.Invoke(null, changeData);
+        }
+
+        //同一属性面板,切换注释工具
+        public void AnnotTypeChangedInvoke(object sender, Dictionary<AnnotArgsType, object> keyValues)
+        {
+            AnnotTypeChanged?.Invoke(sender, keyValues);
+        }
+    }
+}

+ 5 - 4
PDF Office/ViewModels/Tools/AnnotToolContentViewModel.Command.cs

@@ -25,6 +25,7 @@ using System.Windows.Media;
 using System.Diagnostics;
 using PDF_Office.Model.AnnotPanel;
 using System.Windows.Input;
+using PDF_Office.ViewModels.Tools.AnnotManager;
 
 namespace PDF_Office.ViewModels.Tools
 {
@@ -691,25 +692,25 @@ namespace PDF_Office.ViewModels.Tools
                 if (annot.EventType == AnnotArgsType.AnnotFreehand)
                 {
                     var freeHand = annot as FreehandAnnotArgs;
-                    isSolidLineDash = AnnotPropertyPanel.IsSolidStyle(freeHand.LineDash);
+                    isSolidLineDash = AnnotTransfer.IsSolidStyle(freeHand.LineDash);
                     FreeHandAnnotPopMenu.SetIsChecked(isSolidLineDash ? "FreeHandSolid" : "FreeHandDash", true);
                 }
                 else if (annot.EventType == AnnotArgsType.AnnotSquare)
                 {
                     var square = annot as SquareAnnotArgs;
-                    isSolidLineDash = AnnotPropertyPanel.IsSolidStyle(square.LineDash);
+                    isSolidLineDash = AnnotTransfer.IsSolidStyle(square.LineDash);
                     ShapeAnnotPopMenu.SetIsChecked(isSolidLineDash ? "ShapeSolid" : "ShapeDash", true);
                 }
                 else if (annot.EventType == AnnotArgsType.AnnotCircle)
                 {
                     var circle = annot as CircleAnnotArgs;
-                    isSolidLineDash = AnnotPropertyPanel.IsSolidStyle(circle.LineDash);
+                    isSolidLineDash = AnnotTransfer.IsSolidStyle(circle.LineDash);
                     ShapeAnnotPopMenu.SetIsChecked(isSolidLineDash ? "ShapeSolid" : "ShapeDash", true);
                 }
                 else if (annot.EventType == AnnotArgsType.AnnotLine)
                 {
                     var line = annot as LineAnnotArgs;
-                    isSolidLineDash = AnnotPropertyPanel.IsSolidStyle(line.LineDash);
+                    isSolidLineDash = AnnotTransfer.IsSolidStyle(line.LineDash);
                     ShapeAnnotPopMenu.SetIsChecked(isSolidLineDash ? "ShapeSolid" : "ShapeDash", true);
                 }
             }

+ 9 - 8
PDF Office/ViewModels/Tools/AnnotToolContentViewModel.Function.cs

@@ -14,6 +14,7 @@ using PDF_Office.Model.BOTA;
 using PDF_Office.Properties;
 using PDF_Office.ViewModels.BOTA;
 using PDF_Office.ViewModels.PropertyPanel.AnnotPanel;
+using PDF_Office.ViewModels.Tools.AnnotManager;
 using PDF_Office.Views.BOTA;
 using PDF_Office.Views.PropertyPanel.AnnotPanel;
 using PDFSettings;
@@ -1433,7 +1434,7 @@ namespace PDF_Office.ViewModels.Tools
                         FreehandDefault.Opacity = freeHand.Transparency;
                         FreehandDefault.Thickness = freeHand.LineWidth;
 
-                        var isSolid = AnnotPropertyPanel.IsSolidStyle(freeHand.LineDash);
+                        var isSolid = AnnotTransfer.IsSolidStyle(freeHand.LineDash);
                         if (isSolid)
                         {
                             FreehandDefault.DashArray = null;
@@ -1490,7 +1491,7 @@ namespace PDF_Office.ViewModels.Tools
                         SquareDefalut.Opacity = square.Transparency;
                         SquareDefalut.Thickness = square.LineWidth;
 
-                        var isSolid = AnnotPropertyPanel.IsSolidStyle(square.LineDash);
+                        var isSolid = AnnotTransfer.IsSolidStyle(square.LineDash);
                         if (isSolid)
                         {
                             SquareDefalut.DashArray = null;
@@ -1520,7 +1521,7 @@ namespace PDF_Office.ViewModels.Tools
                         CircleDefalut.Opacity = circle.Transparency;
                         CircleDefalut.Thickness = circle.LineWidth;
 
-                        var isSolid = AnnotPropertyPanel.IsSolidStyle(circle.LineDash);
+                        var isSolid = AnnotTransfer.IsSolidStyle(circle.LineDash);
                         if (isSolid)
                         {
                             CircleDefalut.DashArray = null;
@@ -1547,7 +1548,7 @@ namespace PDF_Office.ViewModels.Tools
                         lineDefalut.Opacity = (annot as LineAnnotArgs).Transparency;
                         lineDefalut.Thickness = (annot as LineAnnotArgs).LineWidth;
 
-                        var isSolid = AnnotPropertyPanel.IsSolidStyle(line.LineDash);
+                        var isSolid = AnnotTransfer.IsSolidStyle(line.LineDash);
                         if (isSolid)
                         {
                             lineDefalut.DashArray = null;
@@ -1744,11 +1745,11 @@ namespace PDF_Office.ViewModels.Tools
                     var AnnotEvent = AnnotAttribEvent.GetAnnotAttribEvent(annot, annot.GetAnnotAttrib());
                     if (menu.tag.ToString() == "Solid")
                     {
-                        AnnotEvent?.UpdateAttrib(AnnotAttrib.LineStyle, AnnotPropertyPanel.GetLineDashStyle(true));
+                        AnnotEvent?.UpdateAttrib(AnnotAttrib.LineStyle, AnnotTransfer.GetLineDashStyle(true));
                     }
                     else
                     {
-                        AnnotEvent?.UpdateAttrib(AnnotAttrib.LineStyle, AnnotPropertyPanel.GetLineDashStyle(false));
+                        AnnotEvent?.UpdateAttrib(AnnotAttrib.LineStyle, AnnotTransfer.GetLineDashStyle(false));
                     }
 
                     AnnotEvent?.UpdateAnnot();
@@ -1844,12 +1845,12 @@ namespace PDF_Office.ViewModels.Tools
                     var AnnotEvent = AnnotAttribEvent.GetAnnotAttribEvent(annot, annot.GetAnnotAttrib());
                     if (strTag == "Solid")
                     {
-                        var dashStyle = AnnotPropertyPanel.GetLineDashStyle(true);
+                        var dashStyle = AnnotTransfer.GetLineDashStyle(true);
                         AnnotEvent?.UpdateAttrib(AnnotAttrib.LineStyle, dashStyle);
                     }
                     else
                     {
-                        var dashStyle = AnnotPropertyPanel.GetLineDashStyle(false);
+                        var dashStyle = AnnotTransfer.GetLineDashStyle(false);
                         AnnotEvent?.UpdateAttrib(AnnotAttrib.LineStyle, dashStyle);
                     }
                     AnnotEvent?.UpdateAnnot();

+ 2 - 138
PDF Office/ViewModels/Tools/AnnotToolContentViewModel.Properties.cs

@@ -4,6 +4,7 @@ using ComPDFKitViewer.PdfViewer;
 using PDF_Office.CustomControl;
 using PDF_Office.Helper;
 using PDF_Office.ViewModels.PropertyPanel.AnnotPanel;
+using PDF_Office.ViewModels.Tools.AnnotManager;
 using PDF_Office.Views.PropertyPanel.AnnotPanel;
 using PDFSettings.Settings;
 using Prism.Commands;
@@ -16,143 +17,6 @@ using System.Windows.Media;
 
 namespace PDF_Office.ViewModels.Tools
 {
-    /// <summary>
-    /// 改变工具栏注释属性值,主要用来传参数:注释属性和同步工具栏对应图标的属性(颜色)
-    /// </summary>
-    public class AnnotPropertyPanel
-    {
-        public bool IsAddLink = false;
-        public bool IsLocationLink = false;
-        public AnnotAttribEvent AnnotEvent { get; set; }
-        public List<AnnotAttribEvent> AnnotEvents = new List<AnnotAttribEvent>();
-
-        public AnnotHandlerEventArgs annot;
-        public List<AnnotHandlerEventArgs> annotlists;
-
-        public bool IsTextFill { get; private set; }
-
-        public void SetIsTextFill(bool isTextFill)
-        {
-            IsTextFill = isTextFill;
-        }
-
-        public event EventHandler<Dictionary<AnnotArgsType, object>> DataChanged;
-
-        public event EventHandler<Dictionary<AnnotArgsType, object>> AnnotTypeChanged;
-
-        public event EventHandler<object> DefaultStored;
-
-        public AnnotPropertyPanel()
-        { }
-
-        //外部UI控件选中状态
-        public static bool IsSolidStyle(DashStyle LineDash)
-        {
-            bool isSolid = true;
-            if (LineDash == null || LineDash.Dashes.Count == 0)
-            {
-                return isSolid;
-            }
-
-            foreach (var item in LineDash.Dashes)
-            {
-                if (item > 0)
-                {
-                    isSolid = false;
-                    break;
-                }
-            }
-            return isSolid;
-        }
-
-        public static DashStyle GetLineDashStyle(bool isSolid)
-        {
-            DashStyle newDash = new DashStyle();
-            if (isSolid == false)
-            {
-                newDash.Dashes.Add(2);
-                newDash.Dashes.Add(2);
-            }
-            else
-            {
-                newDash = DashStyles.Solid;
-            }
-
-            return newDash;
-        }
-
-        //单个属性更改
-        public void UpdateAnnotAAttrib(AnnotAttrib annotAttrib, object obj)
-        {
-            if (annotlists != null && annotlists.Count > 1)
-            {
-                foreach (var itemevent in AnnotEvents)
-                {
-                    itemevent?.UpdateAttrib(annotAttrib, obj);
-                    itemevent?.UpdateAnnot();
-                }
-            }
-            else
-            {
-                AnnotEvent?.UpdateAttrib(annotAttrib, obj);
-                AnnotEvent?.UpdateAnnot();
-            }
-        }
-
-        //多个属性更改
-        public void UpdateAnnotAllAttribs(Dictionary<AnnotAttrib, object> AnnotAttribDir)
-        {
-            if (annotlists != null && annotlists.Count > 1)
-            {
-                foreach (var itemevent in AnnotEvents)
-                {
-                    foreach (var item in AnnotAttribDir)
-                    {
-                        itemevent?.UpdateAttrib(item.Key, item.Value);
-                    }
-
-                    itemevent?.UpdateAnnot();
-                }
-            }
-            else
-            {
-                foreach (var item in AnnotAttribDir)
-                {
-                    AnnotEvent?.UpdateAttrib(item.Key, item.Value);
-                }
-
-                AnnotEvent?.UpdateAnnot();
-            }
-        }
-
-        //是否为多选
-        public bool IsMultiSelected
-        { get { return (annotlists != null && annotlists.Count > 1); } }
-
-        /// <summary>
-        /// 更新多个属性,触发到工具栏注释工具,改变工具图标下的颜色值
-        /// </summary>
-        public void InvokeToMyTools(object sender, Dictionary<AnnotArgsType, object> keyValues)
-        {
-            DataChanged?.Invoke(sender, keyValues);
-        }
-
-        /// <summary>
-        /// 更新单个属性
-        /// </summary>
-        public void InvokeToMyTools(AnnotArgsType argsType, object obj)
-        {
-            Dictionary<AnnotArgsType, object> changeData = new Dictionary<AnnotArgsType, object>();
-            changeData[argsType] = obj;
-            DataChanged?.Invoke(null, changeData);
-        }
-
-        //同一属性面板,切换注释工具
-        public void AnnotTypeChangedInvoke(object sender, Dictionary<AnnotArgsType, object> keyValues)
-        {
-            AnnotTypeChanged?.Invoke(sender, keyValues);
-        }
-    }
 
     public sealed partial class AnnotToolContentViewModel
     {
@@ -276,7 +140,7 @@ namespace PDF_Office.ViewModels.Tools
         public OpenFileInfo OpenFileInfo = null;
         public CPDFViewer PDFViewer;
         private ViewContentViewModel viewContentViewModel;
-        private AnnotPropertyPanel propertyPanel = new AnnotPropertyPanel();
+        private AnnotTransfer propertyPanel = new AnnotTransfer();
         private Dictionary<string, AnnotArgsType> ToolExpandDict = new Dictionary<string, AnnotArgsType>();
         private Dictionary<string, string> ToolTipDict = new Dictionary<string, string>();
         private List<Tuple<int, int>> AnnotSignatures = new List<Tuple<int, int>>();

+ 2 - 1
PDF Office/ViewModels/ViewContentViewModel.cs

@@ -36,6 +36,7 @@ using PDF_Office.Properties;
 using PDF_Office.ViewModels.BOTA;
 using PDF_Office.Views.BOTA;
 using System.Drawing;
+using PDF_Office.ViewModels.Tools.AnnotManager;
 
 namespace PDF_Office.ViewModels
 {
@@ -1812,7 +1813,7 @@ namespace PDF_Office.ViewModels
         /// </summary>
         /// <param name="Content"></param>
         /// <param name="annotPropertyPanel"></param>
-        public void SelectedPrpoertyPanel(string Content, AnnotPropertyPanel annotPropertyPanel)
+        public void SelectedPrpoertyPanel(string Content, AnnotTransfer annotPropertyPanel)
         {
             NavigationParameters parameters = new NavigationParameters();
             //传其他参数:文档类,空注释面板;