liyijie 1 год назад
Родитель
Сommit
b87be33c19

+ 1 - 1
PDF Office/EventAggregators/FillAndSignEvent.cs

@@ -11,7 +11,7 @@ namespace PDF_Office.EventAggregators
 
     public class FillAndSigntEventArgs
     {
-        public string Unicode { get; set; }
+        public string Action { get; set; }
         public string AppUnicode { get; set; }
         public List<AnnotHandlerEventArgs> Annots { get; set; }
 

+ 26 - 0
PDF Office/Model/FillAndSign/FillAndSignContentModel.cs

@@ -0,0 +1,26 @@
+using System;
+using System.Collections.Generic;
+using System.Linq;
+using System.Text;
+using System.Threading.Tasks;
+
+namespace PDF_Office.Model.FillAndSign
+{
+    public class FillAndSignContentModel
+    {
+    }
+
+    public class FillAndSignIsShape
+    {
+        public FillAndSignIsShape(int PageIndex, int AnnotIndex, string Shape)
+        {
+            this.PageIndex = PageIndex;
+            this.AnnotIndex = AnnotIndex;
+            this.Shape = Shape;
+        }
+        public int PageIndex;
+        public int AnnotIndex;
+        public string Shape;
+
+    }
+}

+ 1 - 0
PDF Office/PDF Office.csproj

@@ -447,6 +447,7 @@
     <Compile Include="Model\EditTools\HeaderFooter\HeaderFooterCreateModel.cs" />
     <Compile Include="Model\EditTools\Watermark\WatermarkCreateModel.cs" />
     <Compile Include="Model\EditTools\Watermark\WatermarkTemplateListModel.cs" />
+    <Compile Include="Model\FillAndSign\FillAndSignContentModel.cs" />
     <Compile Include="Model\From\FormFieldType.cs" />
     <Compile Include="Model\PageEdit\CustomInsertModel.cs" />
     <Compile Include="Model\PageEdit\CustomPageItem.cs" />

+ 88 - 42
PDF Office/ViewModels/FillAndSign/FillAndSignContentViewModel.cs

@@ -53,6 +53,7 @@ using Size = System.Windows.Size;
 using System.Windows.Markup;
 using Prism.Services.Dialogs;
 using PDF_Office.ViewModels.Tools.AnnotManager;
+using PDF_Office.Model.FillAndSign;
 
 namespace PDF_Office.ViewModels.FillAndSign
 {
@@ -61,15 +62,18 @@ namespace PDF_Office.ViewModels.FillAndSign
         #region 
         public CPDFViewer PDFViewer;
         private AnnotTransfer propertyPanel = new AnnotTransfer();
-        private ViewContentViewModel viewContentViewModel;
+        public ViewContentViewModel viewContentViewModel;
         private bool isRightMenuAddAnnot = false;
         private IEventAggregator events;
         public List<List<Point>> ShapePoints = new List<List<Point>>();
-        private string Shape = "HookShape";
+        public string Shape = "HookShape";
+        private bool IsFillAndSign { get;
+            
+            set; } = true;
         private PopMenu FreeHandAnnotPopMenu;
         private PopMenu FreeTextAnnotPopMenu;
         private PopMenu MultiAnnotPopMenu;
-        public bool isFirst=true;
+        public bool isFirst = true;
         private IRegionManager regions { get; set; }
         private Dictionary<string, AnnotArgsType> ToolExpandDict = new Dictionary<string, AnnotArgsType>();
         public static bool IsEdit = false;
@@ -109,7 +113,7 @@ namespace PDF_Office.ViewModels.FillAndSign
         string Unicode = "";
         public FillAndSignContentViewModel(IRegionManager regionManager, IEventAggregator events) { }
 
-        public FillAndSignContentViewModel(IRegionManager regionManager, IEventAggregator events,IDialogService dialogService)
+        public FillAndSignContentViewModel(IRegionManager regionManager, IEventAggregator events, IDialogService dialogService)
         {
             dialogs = dialogService;
             regions = regionManager;
@@ -136,29 +140,31 @@ namespace PDF_Office.ViewModels.FillAndSign
 
         private void FromFillAndSign(FillAndSigntEventArgs obj)
         {
-            if(obj != null)
+            if (obj != null)
             {
-                if(string.IsNullOrEmpty(obj.Unicode) == false)
+                if (string.IsNullOrEmpty(obj.Action) == false)
                 {
-                    if(obj.Unicode == "Clear")
+                    if (obj.Action == "Clear")
                     {
                         viewContentViewModel.FillAndSign.Clear();
                     }
                     else
                     {
-                        if(obj.Annots != null && obj.Annots.Count > 0)
+                        if (obj.Annots != null && obj.Annots.Count > 0)
                         {
                             if (obj.Annots[0].EventType == AnnotArgsType.AnnotFreehand)
                             {
+                                IsFillAndSign = false;
                                 GetFreehand(obj.Annots);
+                               
                             }
-                            else if(obj.Annots[0].EventType == AnnotArgsType.AnnotFreeText)
+                            else if (obj.Annots[0].EventType == AnnotArgsType.AnnotFreeText)
                             {
                                 GetFreetext(obj.Annots);
                             }
                         }
                     }
-                   
+
                 }
             }
         }
@@ -381,7 +387,7 @@ namespace PDF_Office.ViewModels.FillAndSign
             }
         }
 
-        private DefaultAnnotProperty GetAnnotDefault(AnnotArgsType annotArgsType,string savaKey="")
+        private DefaultAnnotProperty GetAnnotDefault(AnnotArgsType annotArgsType, string savaKey = "")
         {
             var Annot = SettingHelper.GetAnnotDefaultProperty(annotArgsType, savaKey);
             if (Annot == null)
@@ -394,13 +400,13 @@ namespace PDF_Office.ViewModels.FillAndSign
         private void CheckedEvent(object e)
         {
 
-            var control = e as Control;
-        
-            IsEdit = false;
-            
-
-            //NavigateToProperty(control.Name);
-            //不创建注释,属于注释模板
+            var control = e as Control;
+
+            IsEdit = false;
+
+
+            //NavigateToProperty(control.Name);
+            //不创建注释,属于注释模板
             bool isTemplateAnnot = false;
             bool isSnapshotEdit = false;
             AnnotHandlerEventArgs annotArgs = null;
@@ -457,7 +463,7 @@ namespace PDF_Office.ViewModels.FillAndSign
         private void InitCheckedEvent(string e)
         {
             IsEdit = false;
-           
+
 
             //NavigateToProperty(control.Name);
             //不创建注释,属于注释模板
@@ -507,19 +513,20 @@ namespace PDF_Office.ViewModels.FillAndSign
                     ShowPropertyPanel(true);
                 }
             }
-         
+
         }
         //注释工具
         private void FindAnnotTypeKey(string tag, ref AnnotHandlerEventArgs annotArgs, bool isRightMenuAdd = false)
         {
             LineWidthMultiple = 1;
             IsSignPoint = false;
+            Shape = "None";
             switch (tag)
             {
 
-                case "RbtnDate":
-                        DateOrText = "Freetext";
-                        annotArgs = GetFreetext();
+                case "RbtnDate":
+                    DateOrText = "Freetext";
+                    annotArgs = GetFreetext();
                     break;
                 case "RbtnText"://文本
                     DateOrText = "";
@@ -529,8 +536,9 @@ namespace PDF_Office.ViewModels.FillAndSign
                     annotArgs = GetFreetext();
                     break;
                 case "RbtnSign"://签名
+                    PDFViewer.SetMouseMode(MouseModes.PanTool);
                     annotArgs = GetSignature();
-                    PDFViewer.SetMouseMode(MouseModes.PanTool);//清空其他注释
+                    //清空其他注释
                     break;
                 case "RbtnTick"://勾
                     Shape = "HookShape";
@@ -599,7 +607,7 @@ namespace PDF_Office.ViewModels.FillAndSign
             List<AnnotHandlerEventArgs> stampAnnotArgsList = new List<AnnotHandlerEventArgs>();
             if (stampAnnotArgs != null)
                 stampAnnotArgsList.Add(stampAnnotArgs);
-           
+
             //if (selectedArgs != null) { 
             //var annot = selectedArgs[0];
             //if (annot != null)
@@ -621,7 +629,10 @@ namespace PDF_Office.ViewModels.FillAndSign
         public void SetStamp()
         {
             StampAnnotArgs stampAnnotArgs = new StampAnnotArgs();
+            double lineWidthMultiple = LineWidthMultiple;
+            if (Shape == "DotShape") { LineWidthMultiple = 5; }
             stampAnnotArgs.SetInkData(ShapePoints, LineWidth * LineWidthMultiple, (SelectColor as SolidColorBrush).Color);
+            LineWidthMultiple = lineWidthMultiple;
             //PDFViewer.SetMouseMode(MouseModes.AnnotCreate);
             //PDFViewer.SetToolParam(stampArgs);
             //StampAnnotArgs stampAnnotArgs = new StampAnnotArgs();
@@ -649,7 +660,7 @@ namespace PDF_Office.ViewModels.FillAndSign
                 annotArgs.Author = Settings.Default.AppProperties.Description.Author;
                 PDFViewer.SetMouseMode(MouseModes.AnnotCreate);
                 PDFViewer.SetToolParam(annotArgs);
-                
+
                 isRightMenuAddAnnot = false;
             }
 
@@ -718,7 +729,7 @@ namespace PDF_Office.ViewModels.FillAndSign
                     //if (ListPoint((item as FreehandAnnotArgs).RawPointList, ShapePoints)){
                     foreach (var point in viewContentViewModel.FillAndSign)
                     {
-                        if ((item as FreehandAnnotArgs).PageIndex == point.Item1 && (item as FreehandAnnotArgs).AnnotIndex == point.Item2)
+                        if ((item as FreehandAnnotArgs).PageIndex == point.PageIndex && (item as FreehandAnnotArgs).AnnotIndex == point.AnnotIndex)
                         {
 
                             newSelectedArgs.Add(item);
@@ -866,8 +877,8 @@ namespace PDF_Office.ViewModels.FillAndSign
                 if (annots.Count > 1)
                 {
                     if (propertyPanel.AnnotEvents == null)
-                        propertyPanel.AnnotEvents = new List<AnnotAttribEvent>();
-                    
+                        propertyPanel.AnnotEvents = new List<AnnotAttribEvent>();
+
                     propertyPanel.AnnotEvents.Clear();
 
                     foreach (var itemAnnot in annots)
@@ -901,9 +912,10 @@ namespace PDF_Office.ViewModels.FillAndSign
 
                 if (isUpData) { return; }
 
-                if (viewContent == "ShapFillProperty") {
-                    
-                    NavigateToProperty(viewContent, propertyPanel); return; }
+                if (viewContent == "ShapFillProperty")
+                {
+                    NavigateToProperty(viewContent, propertyPanel); return;
+                }
                 viewContentViewModel.SelectedPrpoertyPanel(viewContent, propertyPanel);
             }
 
@@ -914,6 +926,7 @@ namespace PDF_Office.ViewModels.FillAndSign
             NavigationParameters values = new NavigationParameters();
             values.Add(ParameterNames.PDFViewer, PDFViewer);
             values.Add(ParameterNames.PropertyPanelContentViewModel, annotPropertyPanel);
+            values.Add("IsFillAndSign", IsFillAndSign);
             values.Add("Shape", Shape);
             values.Add("FillAndSignContentViewModel", this);
             regions.RequestNavigate(RegionNames.PropertyRegionName, btnName, values);
@@ -1164,9 +1177,9 @@ namespace PDF_Office.ViewModels.FillAndSign
 
                                     case AnnotArgsType.AnnotFreehand:
                                         e.PopupMenu = FreeHandAnnotPopMenu.OpenMenu(selectedAnnot, sender);
-                                        break;
-                                        case AnnotArgsType.AnnotFreeText:
-                                        e.PopupMenu= FreeTextAnnotPopMenu.OpenMenu(selectedAnnot, sender);
+                                        break;
+                                    case AnnotArgsType.AnnotFreeText:
+                                        e.PopupMenu = FreeTextAnnotPopMenu.OpenMenu(selectedAnnot, sender);
                                         break;
 
                                 }
@@ -1480,13 +1493,29 @@ namespace PDF_Office.ViewModels.FillAndSign
                 for (int i = 0; i < e.Count; i++)
                 {
                     AnnotEditEvent editEvent = e[i];
+                    int pageindex = editEvent.PageIndex;
+                    int annotindex = editEvent.AnnotIndex;
                     switch (editEvent.EditAction)
                     {
                         case ActionType.Add:
-                            int pageindex = editEvent.PageIndex;
-                            int annotindex = editEvent.AnnotIndex;
-                            viewContentViewModel.FillAndSign.Add(new Tuple<int,int>(pageindex, annotindex));
-                             PDFViewer.SelectAnnotation(pageindex, annotindex);
+
+                            if (Shape != "None") { viewContentViewModel.FillAndSign.Add(new FillAndSignIsShape(pageindex, annotindex, Shape)); }
+                            PDFViewer.SelectAnnotation(pageindex, annotindex);
+                            break;
+                        case ActionType.Del:
+                            if (Shape != "None")
+                            {
+                                for (int j = 0; j < viewContentViewModel.FillAndSign.Count; j++)
+                                {
+                                    if (viewContentViewModel.FillAndSign[j].PageIndex == pageindex && viewContentViewModel.FillAndSign[j].AnnotIndex == annotindex)
+                                    {
+
+                                        viewContentViewModel.FillAndSign.Remove(viewContentViewModel.FillAndSign[j]);
+                                    }
+                                }
+
+                            }
+
                             break;
                     }
                 }
@@ -1551,7 +1580,7 @@ namespace PDF_Office.ViewModels.FillAndSign
                             else
                             {
                                 ShowPropertyPanel();
-                               
+
                             }
                         }
                     }
@@ -1676,10 +1705,26 @@ namespace PDF_Office.ViewModels.FillAndSign
             {
 
                 case AnnotArgsType.AnnotFreeText:
+                    
                     GetFreetext(e.AnnotItemsList);
                     break;
 
                 case AnnotArgsType.AnnotFreehand:
+                    if (viewContentViewModel.FillAndSign.Count < 1) { viewContentViewModel.SelectedPrpoertyPanel("PropertyPanelContent", null); return; }
+                    bool isDifferen = false;
+                    foreach (var point in viewContentViewModel.FillAndSign)
+                    {
+                        if (annot.PageIndex == point.PageIndex && annot.AnnotIndex == point.AnnotIndex)
+                        {
+                            isDifferen=true;
+                            break;
+                        }
+                        else
+                        {
+                            isDifferen = false;
+                        }
+                    }
+                    if (!isDifferen) { viewContentViewModel.SelectedPrpoertyPanel("PropertyPanelContent", null); return; }
                     GetFreehand(e.AnnotItemsList);
                     break;
 
@@ -1714,10 +1759,11 @@ namespace PDF_Office.ViewModels.FillAndSign
 
         public void OnNavigatedTo(NavigationContext navigationContext)
         {
+            IsFillAndSign = true;
             navigationContext.Parameters.TryGetValue<ViewContentViewModel>(ParameterNames.ViewContentViewModel, out viewContentViewModel);
             navigationContext.Parameters.TryGetValue<CPDFViewer>(ParameterNames.PDFViewer, out PDFViewer);
-            BindingPDFViewerHandler();
-           HookShapeIsCheck = true;
+            BindingPDFViewerHandler();
+            HookShapeIsCheck = true;
             HookShapeIsCheck = false;
             InitFillAndSignProperty();
             ShowPropertyPanel(false);

+ 104 - 16
PDF Office/ViewModels/FillAndSign/PropertyPanel/ShapFillPropertyViewModel.cs

@@ -22,6 +22,7 @@ using static Dropbox.Api.UsersCommon.AccountType;
 using PDF_Office.Model.AnnotPanel;
 using PDFSettings;
 using PDF_Office.ViewModels.Tools.AnnotManager;
+using Prism.Common;
 
 namespace PDF_Office.ViewModels.FillAndSign.PropertyPanel
 {
@@ -33,6 +34,7 @@ namespace PDF_Office.ViewModels.FillAndSign.PropertyPanel
         private FillAndSignContentViewModel fillAndSignContentViewModel;
         public List<List<Point>> updatapath = new List<List<Point>>();
         private Geometry dataPath = null;
+        private bool IsFillAndSign = false;
         public Geometry DataPath
         {
             get { return dataPath; }
@@ -63,7 +65,8 @@ namespace PDF_Office.ViewModels.FillAndSign.PropertyPanel
                     }
                     //else
                     {
-                        fillAndSignContentViewModel.SetStamp();
+                        if(IsFillAndSign) { fillAndSignContentViewModel.SetStamp(); }
+                        
                     }
 
                 }
@@ -89,7 +92,8 @@ namespace PDF_Office.ViewModels.FillAndSign.PropertyPanel
 
                     //else
                     {
-                        fillAndSignContentViewModel.SetStamp();
+                        if (IsFillAndSign) { fillAndSignContentViewModel.SetStamp(); }
+                        
                     }
 
                 }
@@ -127,13 +131,17 @@ namespace PDF_Office.ViewModels.FillAndSign.PropertyPanel
 
                         //PropertyPanel.UpdateAnnotAAttrib(AnnotAttrib.Height, 60);
                         //PropertyPanel.UpdateAnnotAAttrib(AnnotAttrib.Width, 60);
+                        double lineWidthMultiple = fillAndSignContentViewModel.LineWidthMultiple;
+                        if (fillAndSignContentViewModel.Shape == "DotShape") { fillAndSignContentViewModel.LineWidthMultiple = 5; }
                         PropertyPanel.UpdateAnnotAAttrib(AnnotAttrib.Thickness, LineWidth * fillAndSignContentViewModel.LineWidthMultiple);
-                       // PropertyPanel.UpdateAnnotAAttrib(AnnotAttrib.Path, updatapath);
+                        fillAndSignContentViewModel.LineWidthMultiple = lineWidthMultiple;
+                        // PropertyPanel.UpdateAnnotAAttrib(AnnotAttrib.Path, updatapath);
 
                     }
-                   // else
+                    // else
                     {
-                        fillAndSignContentViewModel.SetStamp();
+                        if (IsFillAndSign) { fillAndSignContentViewModel.SetStamp(); }
+                        
                     }
 
                 }
@@ -210,6 +218,20 @@ namespace PDF_Office.ViewModels.FillAndSign.PropertyPanel
                         updatapath = new List<List<Point>> { new List<Point> { new Point(0.599976, 7.0286), new Point(5.57775, 11.8), new Point(13.4, 1.40002) } };
 
                         PropertyPanel.UpdateAnnotAAttrib(AnnotAttrib.Path, updatapath);
+                        if (PropertyPanel.annotlists != null && PropertyPanel.annotlists.Count >= 1)
+                        {
+                            foreach (var annot in PropertyPanel.annotlists)
+                            {
+
+                                foreach (var point in fillAndSignContentViewModel.viewContentViewModel.FillAndSign)
+                                {
+                                    if (annot.PageIndex == point.PageIndex && annot.AnnotIndex == point.AnnotIndex)
+                                    {
+                                        point.Shape = "HookShape";
+                                    }
+                                }
+                            }
+                        }
                     }
                     //PropertyPanel.UpdateAnnotAAttrib();
                     //fillAndSignContentViewModel.ShapePoints = new List<List<Point>> { new List<Point> { new Point(0.599976, 7.0286), new Point(5.57775, 11.8), new Point(13.4, 1.40002) } };
@@ -221,11 +243,26 @@ namespace PDF_Office.ViewModels.FillAndSign.PropertyPanel
                     var forkShape = new PathGeometry();
                     forkShape.AddGeometry(Geometry.Parse("M3.19995 3.20001L12.8 12.8 M12.8 3.20001L3.20005 12.8"));
                     DataPath = forkShape;
-                   // if (FillAndSignContentViewModel.IsEdit)
+                    // if (FillAndSignContentViewModel.IsEdit)
                     {
                         PropertyPanel.UpdateAnnotAAttrib(AnnotAttrib.Thickness, LineWidth * fillAndSignContentViewModel.LineWidthMultiple);
                         updatapath = new List<List<Point>> { new List<Point> { new Point(3.19995, 3.20001), new Point(12.8, 12.8) }, new List<Point> { new Point(12.8, 3.20001), new Point(3.20005, 12.8) } };
                         PropertyPanel.UpdateAnnotAAttrib(AnnotAttrib.Path, updatapath);
+                        if (PropertyPanel.annotlists != null && PropertyPanel.annotlists.Count >= 1)
+                        {
+                            foreach (var annot in PropertyPanel.annotlists)
+                            {
+
+                                foreach (var point in fillAndSignContentViewModel.viewContentViewModel.FillAndSign)
+                                {
+                                    if (annot.PageIndex == point.PageIndex && annot.AnnotIndex == point.AnnotIndex)
+                                    {
+                                        point.Shape = "ForkShape";
+                                    }
+                                }
+                            }
+                        }
+
                     }
                     //fillAndSignContentViewModel.ShapePoints = new List<List<Point>> { new List<Point> { new Point(3.19995, 3.20001), new Point(12.8, 12.8) }, new List<Point> { new Point(12.8, 3.20001), new Point(3.20005, 12.8) } };
                     //fillAndSignContentViewModel.SetStamp();
@@ -242,6 +279,20 @@ namespace PDF_Office.ViewModels.FillAndSign.PropertyPanel
                             PropertyPanel.UpdateAnnotAAttrib(AnnotAttrib.Thickness, LineWidth * fillAndSignContentViewModel.LineWidthMultiple);
                             updatapath = new List<List<Point>> { new List<Point> { new Point(5, 5), new Point(28, 5) }, new List<Point> { new Point(28, 5), new Point(28, 27) }, new List<Point> { new Point(28, 27), new Point(5, 27) }, new List<Point> { new Point(5, 27), new Point(5, 5) } };
                             PropertyPanel.UpdateAnnotAAttrib(AnnotAttrib.Path, updatapath);
+                            if (PropertyPanel.annotlists != null && PropertyPanel.annotlists.Count >= 1)
+                            {
+                                foreach (var annot in PropertyPanel.annotlists)
+                                {
+
+                                    foreach (var point in fillAndSignContentViewModel.viewContentViewModel.FillAndSign)
+                                    {
+                                        if (annot.PageIndex == point.PageIndex && annot.AnnotIndex == point.AnnotIndex)
+                                        {
+                                            point.Shape = "RectShape";
+                                        }
+                                    }
+                                }
+                            }
                         }
                         //fillAndSignContentViewModel.ShapePoints = new List<List<Point>> { new List<Point> { new Point(0.19995, 5), new Point(28, 5), new Point(28, 27), new Point(0.19995, 27), new Point(0.19995, 5) } };
                         //fillAndSignContentViewModel.SetStamp();
@@ -254,11 +305,25 @@ namespace PDF_Office.ViewModels.FillAndSign.PropertyPanel
                         var lineShape = new PathGeometry();
                         lineShape.AddGeometry(Geometry.Parse(" M0,10L20,10"));
                         DataPath = lineShape;
-                       // if (FillAndSignContentViewModel.IsEdit)
+                        // if (FillAndSignContentViewModel.IsEdit)
                         {
                             PropertyPanel.UpdateAnnotAAttrib(AnnotAttrib.Thickness, LineWidth * fillAndSignContentViewModel.LineWidthMultiple);
                             updatapath = new List<List<Point>> { new List<Point> { new Point(3.19995, 3.20001), new Point(28, 3.20001) } };
                             PropertyPanel.UpdateAnnotAAttrib(AnnotAttrib.Path, updatapath);
+                            if (PropertyPanel.annotlists != null && PropertyPanel.annotlists.Count >= 1)
+                            {
+                                foreach (var annot in PropertyPanel.annotlists)
+                                {
+
+                                    foreach (var point in fillAndSignContentViewModel.viewContentViewModel.FillAndSign)
+                                    {
+                                        if (annot.PageIndex == point.PageIndex && annot.AnnotIndex == point.AnnotIndex)
+                                        {
+                                            point.Shape = "LineShape";
+                                        }
+                                    }
+                                }
+                            }
                         }
                         //fillAndSignContentViewModel.ShapePoints = new List<List<Point>> { new List<Point> { new Point(12.19995, 10), new Point(36, 10) } };
                         //fillAndSignContentViewModel.SetStamp();
@@ -274,13 +339,26 @@ namespace PDF_Office.ViewModels.FillAndSign.PropertyPanel
                         circlePath.RadiusY = 2.4;
                         circlePath.Center = new Point(2.4, 2.4);
                         DataPath = circlePath;
-                       // if (FillAndSignContentViewModel.IsEdit)
+                        // if (FillAndSignContentViewModel.IsEdit)
                         {
                             fillAndSignContentViewModel.LineWidthMultiple = 4;
                             updatapath = new List<List<Point>> { new List<Point> { new Point(3.19995, 3.19995), new Point(3.19995, 3.19995) } };
                             PropertyPanel.UpdateAnnotAAttrib(AnnotAttrib.Thickness, LineWidth * fillAndSignContentViewModel.LineWidthMultiple);
                             PropertyPanel.UpdateAnnotAAttrib(AnnotAttrib.Path, updatapath);
+                            if (PropertyPanel.annotlists != null && PropertyPanel.annotlists.Count >= 1)
+                            {
+                                foreach (var annot in PropertyPanel.annotlists)
+                                {
 
+                                    foreach (var point in fillAndSignContentViewModel.viewContentViewModel.FillAndSign)
+                                    {
+                                        if (annot.PageIndex == point.PageIndex && annot.AnnotIndex == point.AnnotIndex)
+                                        {
+                                            point.Shape = "DotShape";
+                                        }
+                                    }
+                                }
+                            }
                         }
                         //fillAndSignContentViewModel.ShapePoints = new List<List<Point>> { new List<Point> { new Point(0.19995, 1.19995), new Point(0.19995, -1.19995) }, new List<Point> { new Point(-0.25995, 0.89995), new Point(0.25995, -0.89995) }, new List<Point> { new Point(-1.19995, 0.19995), new Point(0.19995, 1.19995) } };
                         //fillAndSignContentViewModel.SetStamp();
@@ -423,6 +501,9 @@ namespace PDF_Office.ViewModels.FillAndSign.PropertyPanel
             navigationContext.Parameters.TryGetValue<AnnotTransfer>(ParameterNames.PropertyPanelContentViewModel, out PropertyPanel);
             navigationContext.Parameters.TryGetValue<FillAndSignContentViewModel>("FillAndSignContentViewModel", out fillAndSignContentViewModel);
             navigationContext.Parameters.TryGetValue<string>("Shape", out shape);
+            bool isFillAndSign = false;
+            navigationContext.Parameters.TryGetValue<bool>("IsFillAndSign", out isFillAndSign);
+            IsFillAndSign = isFillAndSign;
             InitSharpsType(shape);
             //FillAndSignContentViewModel.IsEdit = false;
             if (PropertyPanel != null)
@@ -450,21 +531,28 @@ namespace PDF_Office.ViewModels.FillAndSign.PropertyPanel
                 }
                 else
                 {
-                    GetAnnotProperty();
-                }
-
+                    GetAnnotProperty(shape);
+                }
+
             }
         }
 
-        private void GetAnnotProperty()
+        private void GetAnnotProperty(string shape)
         {
-            if (Annot is StickyAnnotArgs)
+            if (Annot is FreehandAnnotArgs)
             {
-                var annot = Annot as StickyAnnotArgs;
+                var annot = Annot as FreehandAnnotArgs;
                 if (annot != null)
                 {
-                    SelectColor = new SolidColorBrush(annot.Color);
-                    FillOpacity = annot.Transparency;
+                    //SelectColor = new SolidColorBrush(annot.InkColor);
+                    //FillOpacity = annot.Transparency;
+                    foreach (var point in fillAndSignContentViewModel.viewContentViewModel.FillAndSign)
+                    {
+                        if (annot.PageIndex == point.PageIndex && annot.AnnotIndex == point.AnnotIndex)
+                        {
+                            InitSharpsType(point.Shape);
+                        }
+                    }
                 }
 
             }

+ 4 - 4
PDF Office/ViewModels/Tools/AnnotToolContentViewModel.Function.cs

@@ -626,10 +626,10 @@ namespace PDF_Office.ViewModels.Tools
         {
             if (viewContentViewModel.FillAndSign != null && viewContentViewModel.FillAndSign.Count > 0 && annots != null && annots.Count > 0)
             {
-                var annotFillAndSign = viewContentViewModel.FillAndSign.FirstOrDefault(temp => temp.Item1 == annots[0].PageIndex && temp.Item2 == annots[0].AnnotIndex);
+                var annotFillAndSign = viewContentViewModel.FillAndSign.FirstOrDefault(temp => temp.PageIndex == annots[0].PageIndex && temp.AnnotIndex == annots[0].AnnotIndex);
                 if (annotFillAndSign != null)
                 {
-                    this.events.GetEvent<FillAndSignEvent>().Publish(new FillAndSigntEventArgs { Unicode = tag, AppUnicode = App.mainWindowViewModel.SelectedItem.Unicode, Annots = annots });
+                    this.events.GetEvent<FillAndSignEvent>().Publish(new FillAndSigntEventArgs { Action = tag, AppUnicode = App.mainWindowViewModel.SelectedItem.Unicode, Annots = annots });
                     return true;
                 }
             }
@@ -640,9 +640,9 @@ namespace PDF_Office.ViewModels.Tools
         {
             if (obj != null)
             {
-                if (string.IsNullOrEmpty(obj.Unicode) == false)
+                if (string.IsNullOrEmpty(obj.Action) == false)
                 {
-                    if (obj.Unicode == "Clear")
+                    if (obj.Action == "Clear")
                     {
                         AnnotSignatures.Clear();
                     }

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

@@ -37,6 +37,7 @@ using PDF_Office.ViewModels.BOTA;
 using PDF_Office.Views.BOTA;
 using System.Drawing;
 using PDF_Office.ViewModels.Tools.AnnotManager;
+using PDF_Office.Model.FillAndSign;
 
 namespace PDF_Office.ViewModels
 {
@@ -247,8 +248,10 @@ namespace PDF_Office.ViewModels
 
         public string BackgroundContentRegionName { get; set; }
 
+        
+
         //若point不赋值或从列表中找不到point,系统会提供默认值为(0,0)的新point,所以改用Tuple<int,int>
-        public List<Tuple<int, int>> FillAndSign = new List<Tuple<int, int>>();
+        public List<FillAndSignIsShape> FillAndSign = new List<FillAndSignIsShape>();
 
         /// <summary>
         /// 文档的密码
@@ -550,7 +553,7 @@ namespace PDF_Office.ViewModels
             set
             {
                 if (events != null && canSave == false)
-                    this.events.GetEvent<FillAndSignEvent>().Publish(new FillAndSigntEventArgs { Unicode = "Clear", AppUnicode = unicode });
+                    this.events.GetEvent<FillAndSignEvent>().Publish(new FillAndSigntEventArgs { Action = "Clear", AppUnicode = unicode });
 
                 SetProperty(ref canSave, value);
             }