using ComPDFKitViewer.AnnotEvent; using ComPDFKitViewer; using Prism.Mvvm; using Prism.Regions; using System; using System.Collections.Generic; using System.Linq; using System.Text; using System.Threading.Tasks; using System.Windows; using System.Windows.Media; using Prism.Commands; using System.Windows.Controls; using ComPDFKit.PDFAnnotation; using PDF_Master.Helper; using System.Diagnostics; using PDF_Master.Model; using PDF_Master.ViewModels.Tools; using Microsoft.Office.Interop.Excel; using Point = System.Windows.Point; using static Dropbox.Api.UsersCommon.AccountType; using PDF_Master.Model.AnnotPanel; using PDFSettings; using PDF_Master.ViewModels.Tools.AnnotManager; using Prism.Common; using ComPDFKitViewer.PdfViewer; using PDF_Master.CustomControl.CompositeControl; using Microsoft.Office.Interop.Word; using System.Diagnostics.Eventing.Reader; using PDF_Master.EventAggregators; namespace PDF_Master.ViewModels.FillAndSign.PropertyPanel { public class ShapFillPropertyViewModel : BindableBase, INavigationAware { public AnnotAttribEvent AnnotEvent { get; set; } private AnnotHandlerEventArgs Annot; private AnnotTransfer PropertyPanel; private FillAndSignContentViewModel fillAndSignContentViewModel; public List> updatapath = new List>(); private Geometry dataPath = null; private bool IsFillAndSign = false; private bool IsUpDataCreate = false; public string shape = ""; public string Shape { get { return shape; } set { SetProperty(ref shape, value); } } public bool _isCreate = false; public bool IsCreate { get { if (fillAndSignContentViewModel != null) { if (fillAndSignContentViewModel.PDFViewer.MouseMode != MouseModes.AnnotCreate) { return false; } else { return true; } } else { return false; } } } public string shapeType = ""; public string ShapeType { get { return shapeType; } set { SetProperty(ref shapeType, value); } } public Geometry DataPath { get { return dataPath; } set { SetProperty(ref dataPath, value); } } private void InitColorItems() { } private Brush selectColor = new SolidColorBrush(Color.FromArgb(0xff, 0x26, 0x25, 0x29)); public Brush SelectColor { get { return selectColor; } set { SetProperty(ref selectColor, value); UPDataColor(); } } private double fillOpacity = 1; public double FillOpacity { get { return fillOpacity; } set { SetProperty(ref fillOpacity, value); //if (!fillAndSignContentViewModel.isFirst) //{ // fillAndSignContentViewModel.FillOpacity = value; // //if (FillAndSignContentViewModel.IsEdit) // { // PropertyPanel.UpdateAnnotAAttrib(AnnotAttrib.Transparency, fillOpacity); // } // //else // { // if (IsFillAndSign) { fillAndSignContentViewModel.SetStamp(); } // } //} } } private bool _hookIsChecked = false; public bool HookIsChecked { get { return _hookIsChecked; } set { SetProperty(ref _hookIsChecked, value); } } private bool _forkIsChecked = false; public bool ForkIsChecked { get { return _forkIsChecked; } set { SetProperty(ref _forkIsChecked, value); } } private bool _rectIsChecked = false; public bool RectIsChecked { get { return _rectIsChecked; } set { SetProperty(ref _rectIsChecked, value); } } private bool _lineIsChecked = false; public bool LineIsChecked { get { return _lineIsChecked; } set { SetProperty(ref _lineIsChecked, value); } } private bool _dotIsChecked = false; public bool DotIsChecked { get { return _dotIsChecked; } set { SetProperty(ref _dotIsChecked, value); } } private bool _isMultiSelected = false; public bool IsMultiSelected { get { return _isMultiSelected; } set { SetProperty(ref _isMultiSelected, value); if (value) { ShapeType = "General Properties"; } } } private bool _isSelected = false; public bool IsSelected { get { return _isSelected; } set => SetProperty(ref _isSelected, value); } private double lineWidthMultiple = 1; private double lineWidth = 1; public double LineWidth { get { return lineWidth; } set { SetProperty(ref lineWidth, value); } } private Brush _shapeColortColor = new SolidColorBrush(Color.FromArgb(0xff, 0x26, 0x25, 0x29)); public Brush ShapeColorColor { get { return _shapeColortColor; } set { SetProperty(ref _shapeColortColor, value); } } List shapeColorItems = new List(); public List ShapeColorItems { get { return shapeColorItems; } set { SetProperty(ref shapeColorItems, value); } } private void InitShapeColorList() { ShapeColorItems = new List(); ColorItem colorItem = new ColorItem(Color.FromArgb(0xff, 0xfc, 0x1f, 0x1f), 0); ShapeColorItems.Add(colorItem); colorItem = new ColorItem(Color.FromArgb(0xff, 0x26, 0x25, 0x29), 1); ShapeColorItems.Add(colorItem); colorItem = new ColorItem(Color.FromArgb(0xff, 0x29, 0x53, 0x93), 2); ShapeColorItems.Add(colorItem); colorItem = new ColorItem(Color.FromArgb(0xff, 0x1e, 0x89, 0x56), 3); ShapeColorItems.Add(colorItem); } private DefaultAnnotProperty GetAnnotDefault(AnnotArgsType annotArgsType, string savaKey = "") { var Annot = SettingHelper.GetAnnotDefaultProperty(annotArgsType, savaKey); if (Annot == null) { Annot = new DefaultAnnotProperty(); Annot.AnnotToolType = annotArgsType; } return Annot; } public DelegateCommand SelectedThickCommand { get; set; } public DelegateCommand SelectedColorCommand { get; set; } //public DelegateCommand LineStyleCommand { get; set; } public DelegateCommand SelectedLineWidthValueCommand { get; set; } public DelegateCommand SharpsTypeCommand { get; set; } public DelegateCommand ThicknessChangedCommand { get; set; } public DelegateCommand SelectedOpacityValueCommand { get; set; } public ShapFillPropertyViewModel() { InitShapeColorList(); SelectedThickCommand = new DelegateCommand(SelectedThick_Command); SelectedColorCommand = new DelegateCommand(SelectedColor_Command); SelectedLineWidthValueCommand = new DelegateCommand(SelectedLineWitdh_Command); //LineStyleCommand = new DelegateCommand(LineStyle_Command); SharpsTypeCommand = new DelegateCommand(SharpsType_Command); ThicknessChangedCommand = new DelegateCommand(ThicknessChanged_Command); SelectedOpacityValueCommand = new DelegateCommand(SelectedOpacityValue); } private void InitFillAndSignProperty() { if (fillAndSignContentViewModel.isFirst) { ShapeColorColor = fillAndSignContentViewModel.SelectColor; fillAndSignContentViewModel.SelectColor = ShapeColorColor; FillOpacity = fillAndSignContentViewModel.FillOpacity; //LineWidth = fillAndSignContentViewModel.LineWidth; } fillAndSignContentViewModel.isFirst = false; } private DefaultAnnotProperty GetAnnotDefault(AnnotArgsType annotArgsType) { var Annot = SettingHelper.GetAnnotDefaultProperty(annotArgsType, "FillAndSign"); if (Annot == null) { Annot = new DefaultAnnotProperty(); Annot.AnnotToolType = annotArgsType; } return Annot; } private void SharpsType_Command(object obj) { if (obj != null) { var tag = (string)obj; SharpsType(tag, obj); } } private void SharpsType(string tag, object obj, bool isFromToolsBtn = false) { fillAndSignContentViewModel.LineWidthMultiple = 1; Dictionary changeData = new Dictionary(); lineWidthMultiple = 1; //PropertyPanel.UpdateAnnotAAttrib(AnnotAttrib.Width, 60); //PropertyPanel.UpdateAnnotAAttrib(AnnotAttrib.Height, 60); switch (tag) { case "HookShape": var hookShape = new PathGeometry(); hookShape.AddGeometry(Geometry.Parse("M0.599976 7.0286L5.57775 11.8L13.4 1.40002")); DataPath = hookShape; //if (FillAndSignContentViewModel.IsEdit) { PropertyPanel.UpdateAnnotAAttrib(AnnotAttrib.Thickness, LineWidth * fillAndSignContentViewModel.LineWidthMultiple); updatapath = fillAndSignContentViewModel.keyShape[tag]; 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> { new List { new Point(0.599976, 7.0286), new Point(5.57775, 11.8), new Point(13.4, 1.40002) } }; //fillAndSignContentViewModel.SetStamp(); //changeData[AnnotArgsType.AnnotLine] = tag; break; case "ForkShape": 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) { PropertyPanel.UpdateAnnotAAttrib(AnnotAttrib.Thickness, LineWidth * fillAndSignContentViewModel.LineWidthMultiple); updatapath = fillAndSignContentViewModel.keyShape[tag]; 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> { new List { new Point(3.19995, 3.20001), new Point(12.8, 12.8) }, new List { new Point(12.8, 3.20001), new Point(3.20005, 12.8) } }; //fillAndSignContentViewModel.SetStamp(); //changeData[AnnotArgsType.AnnotLine] = tag; break; case "RectShape": { RectangleGeometry rectPath = new RectangleGeometry(); rectPath.Rect = new Rect(0, 5, 28, 22); DataPath = rectPath; //if (FillAndSignContentViewModel.IsEdit) { PropertyPanel.UpdateAnnotAAttrib(AnnotAttrib.Thickness, LineWidth * fillAndSignContentViewModel.LineWidthMultiple); updatapath = fillAndSignContentViewModel.keyShape[tag]; 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> { new List { 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(); // changeData[AnnotArgsType.AnnotSquare] = tag; } break; case "LineShape": { var lineShape = new PathGeometry(); lineShape.AddGeometry(Geometry.Parse(" M0,10L20,10")); DataPath = lineShape; // if (FillAndSignContentViewModel.IsEdit) { PropertyPanel.UpdateAnnotAAttrib(AnnotAttrib.Thickness, LineWidth * fillAndSignContentViewModel.LineWidthMultiple); updatapath = fillAndSignContentViewModel.keyShape[tag]; 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> { new List { new Point(12.19995, 10), new Point(36, 10) } }; //fillAndSignContentViewModel.SetStamp(); //changeData[AnnotArgsType.AnnotLine] = tag; } break; case "DotShape": { //fillAndSignContentViewModel.LineWidthMultiple = 5; EllipseGeometry circlePath = new EllipseGeometry(); circlePath.RadiusX = 2.4; circlePath.RadiusY = 2.4; circlePath.Center = new Point(2.4, 2.4); DataPath = circlePath; // if (FillAndSignContentViewModel.IsEdit) { lineWidthMultiple = 5; updatapath = fillAndSignContentViewModel.keyShape[tag]; PropertyPanel.UpdateAnnotAAttrib(AnnotAttrib.Thickness, 10); 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> { new List { new Point(0.19995, 1.19995), new Point(0.19995, -1.19995) }, new List { new Point(-0.25995, 0.89995), new Point(0.25995, -0.89995) }, new List { new Point(-1.19995, 0.19995), new Point(0.19995, 1.19995) } }; //fillAndSignContentViewModel.SetStamp(); //changeData[AnnotArgsType.AnnotCircle] = tag; } break; } //if (isFromToolsBtn == false) // PropertyPanel.AnnotTypeChangedInvoke(this, changeData); } private string UPDateShapeType(string tag) { switch (tag) { case "DotShape": return "Dot"; case "LineShape": return "Line"; case "RectShape": return "Rectangle"; case "ForkShape": return "Fork"; case "HookShape": return "Hook"; default: return "General Properties"; } } private void InitShapesType(string tag) { ShapeType = UPDateShapeType(tag); Trace.WriteLine("ShapeType" + ShapeType); fillAndSignContentViewModel.LineWidthMultiple = 1; switch (tag) { case "HookShape": var hookShape = new PathGeometry(); hookShape.AddGeometry(Geometry.Parse("M0.599976 7.0286L5.57775 11.8L13.4 1.40002")); DataPath = hookShape; break; case "ForkShape": var forkShape = new PathGeometry(); forkShape.AddGeometry(Geometry.Parse("M3.19995 3.20001L12.8 12.8 M12.8 3.20001L3.20005 12.8")); DataPath = forkShape; break; case "RectShape": { RectangleGeometry rectPath = new RectangleGeometry(); rectPath.Rect = new Rect(0, 5, 28, 22); DataPath = rectPath; } break; case "LineShape": { var lineShape = new PathGeometry(); lineShape.AddGeometry(Geometry.Parse(" M0,10L20,10")); DataPath = lineShape; } break; case "DotShape": { //fillAndSignContentViewModel.LineWidthMultiple = 5; //EllipseGeometry circlePath = new EllipseGeometry(); //circlePath.RadiusX = 2.4; //circlePath.RadiusY = 2.4; //circlePath.Center = new Point(2.4, 2.4); var circlePath = new PathGeometry(); circlePath.AddGeometry(Geometry.Parse(" M2.4,2.4m-2.4,0a2.4,2.4,0,1,0,4.8,0a2.4,2.4,0,1,0,-4.8,0M2.4,2.4L2.4,4.8M2.4,2.4L4.8,2.4M2.4,2.4L2.4,0M2.4,2.4L0,2.4M2.4,2.4m-1.2,0a1.2,1.2,0,1,0,2.4,0a1.2,1.2,0,1,0,-2.4,0M2.4,2.4m-1.6,0a1.6,1.6,0,1,0,3.2,0a1.6,1.6,0,1,0,-3.2,0")); DataPath = circlePath; } break; } //if (isFromToolsBtn == false) // PropertyPanel.AnnotTypeChangedInvoke(this, changeData); } private void SelectedThick_Command(object obj) { if (obj is double) { var tran = (double)obj; //BorderOpacity = tran; SelectColor.Opacity = tran; //AnnotEvent?.UpdateAttrib(AnnotAttrib.Transparency, tran); //AnnotEvent?.UpdateAnnot(); } } private void ThicknessChanged_Command(object obj) { if (obj != null) { var item = (ComboBoxItem)obj; var content = (string)item.Content; if (content != null) { var intData = int.Parse(content); LineWidth = intData; UPDataLineWidth(); } } } private void UPDataLineWidth() { if (!fillAndSignContentViewModel.isFirst) { //if (FillAndSignContentViewModel.IsEdit) { if (!fillAndSignContentViewModel.IsClickNull) PropertyPanel.UpdateAnnotAAttrib(AnnotAttrib.Thickness, LineWidth * lineWidthMultiple); } // else { if (IsFillAndSign&&IsUpDataCreate && IsCreate) { fillAndSignContentViewModel.LineWidth = LineWidth; fillAndSignContentViewModel.SetStamp(); } } } } private void UPDataColor() { if (!fillAndSignContentViewModel.isFirst) { var newColor = (ShapeColorColor as SolidColorBrush).Color; var oldColor = (SelectColor as SolidColorBrush).Color; if (newColor.A != oldColor.A || newColor.B != oldColor.B || newColor.R != oldColor.R || newColor.G != oldColor.G) { ShapeColorColor = SelectColor; //if (FillAndSignContentViewModel.IsEdit) { // PropertyPanel.UpdateAnnotAAttrib(AnnotAttrib.Thickness, LineWidth * lineWidthMultiple); if (!fillAndSignContentViewModel.IsClickNull) PropertyPanel.UpdateAnnotAAttrib(AnnotAttrib.Color, (selectColor as SolidColorBrush).Color); } //else { if (IsFillAndSign&&IsUpDataCreate&&IsCreate) { fillAndSignContentViewModel.SelectColor = SelectColor; fillAndSignContentViewModel.SetStamp(); } } } } } private void UPDataOpacity() { if (!fillAndSignContentViewModel.isFirst) { //if (FillAndSignContentViewModel.IsEdit) { if (!fillAndSignContentViewModel.IsClickNull) PropertyPanel.UpdateAnnotAAttrib(AnnotAttrib.Transparency, fillOpacity); } //else { if (IsFillAndSign&&IsUpDataCreate&&IsCreate) { fillAndSignContentViewModel.FillOpacity = FillOpacity; fillAndSignContentViewModel.SetStamp(); } } } } private void SelectedColor_Command(object obj) { if (obj != null) { var colorValue = (Color)obj; if (colorValue != null) { SelectColor = new SolidColorBrush(colorValue); UPDataColor(); SelectColor.Opacity = FillOpacity; Dictionary changeData = new Dictionary(); changeData[AnnotArgsType.AnnotFreehand] = obj; //PropertyPanel.DataChangedInvoke(this, changeData); } } } private void SelectedLineWitdh_Command(object obj) { if (obj != null) { double colorValue = (double)obj; UPDataLineWidth(); } } private void SelectedOpacityValue(object obj) { if (obj != null) { FillOpacity = (double)obj; SelectColor.Opacity = FillOpacity; UPDataOpacity(); //AnnotEvent?.UpdateAttrib(AnnotAttrib.Transparency, FillOpacity); //AnnotEvent?.UpdateAnnot(); Dictionary changeData = new Dictionary(); changeData[AnnotArgsType.AnnotFreehand] = FillOpacity; //PropertyPanel.DataChangedInvoke(this, changeData); } } private void BindingPDFViewerHandler() { //来自PDFViewer的响应事件 if (fillAndSignContentViewModel.PDFViewer != null) { fillAndSignContentViewModel.PDFViewer.AnnotActiveHandler -= PDFViewer_AnnotActiveHandler; fillAndSignContentViewModel.PDFViewer.AnnotActiveHandler += PDFViewer_AnnotActiveHandler; } } private void UnBindingPDFViewerHandler() { if (fillAndSignContentViewModel.PDFViewer != null) { fillAndSignContentViewModel.PDFViewer.AnnotActiveHandler -= PDFViewer_AnnotActiveHandler; } } private void PDFViewer_AnnotActiveHandler(object sender, AnnotAttribEvent e) { if (e != null) { } else { if (fillAndSignContentViewModel.PDFViewer.MouseMode == MouseModes.AnnotCreate) { IsSelected = true; } } } public bool IsNavigationTarget(NavigationContext navigationContext) { return true; } public void OnNavigatedFrom(NavigationContext navigationContext) { UnBindingPDFViewerHandler(); } public void OnNavigatedTo(NavigationContext navigationContext) { string shape = ""; navigationContext.Parameters.TryGetValue(ParameterNames.PropertyPanelContentViewModel, out PropertyPanel); navigationContext.Parameters.TryGetValue("FillAndSignContentViewModel", out fillAndSignContentViewModel); navigationContext.Parameters.TryGetValue("Shape", out shape); bool isFillAndSign = false; navigationContext.Parameters.TryGetValue("IsFillAndSign", out isFillAndSign); IsFillAndSign = isFillAndSign; InitShapesType(shape); InitIsCheck(); //FillAndSignContentViewModel.IsEdit = false; if (PropertyPanel != null) { AnnotEvent = PropertyPanel.AnnotEvent; Annot = PropertyPanel.annot; var stampAnnotArgs = Annot as StampAnnotArgs; if (PropertyPanel.annotlists != null && PropertyPanel.annotlists.Count > 1) { IsMultiSelected = true; } else { IsMultiSelected = false; } IsSelected = !FillAndSignContentViewModel.IsEdit; InitFillAndSignProperty(); if (IsMultiSelected) { IsAttributeEquals(); } else { GetAnnotProperty(shape); } BindingPDFViewerHandler(); } } private void InitIsCheck() { LineIsChecked = false; DotIsChecked = false; RectIsChecked = false; HookIsChecked = false; ForkIsChecked = false; } private List ConvertLists() { List Lists = new List(); foreach (var item in PropertyPanel.annotlists) { var selecteditem = item as FreehandAnnotArgs; if (selecteditem != null) { Lists.Add(selecteditem); } } if (Lists.Count != PropertyPanel.annotlists.Count) return null; else return Lists; } private void IsAttributeEquals() { var list = ConvertLists(); if (list != null) { var temp = list[0]; Dictionary isNoEqualsDir = new Dictionary(); isNoEqualsDir.Add("Color", false); isNoEqualsDir.Add("Shape", false); string tempShape = ""; foreach (var point in fillAndSignContentViewModel.viewContentViewModel.FillAndSign) { if (temp.PageIndex == point.PageIndex && temp.AnnotIndex == point.AnnotIndex) { tempShape = point.Shape; } } foreach (var item in list) { if (item == list[0]) continue; //区分图形是否一致,不一致则属性不选中任何图形 if (isNoEqualsDir["Shape"] == false) { foreach (var point in fillAndSignContentViewModel.viewContentViewModel.FillAndSign) { if (item.PageIndex == point.PageIndex && item.AnnotIndex == point.AnnotIndex) { lineWidthMultiple = 1; if (point.Shape != tempShape) { isNoEqualsDir["Shape"] = true; } } } } if (isNoEqualsDir["Color"] == false) { if (temp.InkColor.A != item.InkColor.A || temp.InkColor.R != item.InkColor.R || temp.InkColor.G != item.InkColor.G || temp.InkColor.B != item.InkColor.B) { ShapeColorColor = new SolidColorBrush(Color.FromArgb(0x01, 0xff, 0xff, 0xff)); isNoEqualsDir["Color"] = true; } } } if (isNoEqualsDir["Shape"] == false) { if (tempShape == "DotShape") { ShapeType = "DotShape"; DotIsChecked = true; } if (tempShape == "LineShape") { ShapeType = "LineShape"; LineIsChecked = true; } if (tempShape == "HookShape") { ShapeType = "HookShape"; HookIsChecked = true; } if (tempShape == "RectShape") { ShapeType = "RectShape"; RectIsChecked = true; } if (tempShape == "ForkShape") { ShapeType = "ForkShape"; ForkIsChecked = true; } } if (isNoEqualsDir["Color"] == false) { ShapeColorColor = new SolidColorBrush(temp.InkColor); } } } private void GetAnnotProperty(string shape) { if (Annot is FreehandAnnotArgs) { var annot = Annot as FreehandAnnotArgs; if (annot != null) { try { foreach (var point in fillAndSignContentViewModel.viewContentViewModel.FillAndSign) { if (annot.PageIndex == point.PageIndex && annot.AnnotIndex == point.AnnotIndex) { lineWidthMultiple = 1; if (point.Shape == "DotShape") { DotIsChecked = true; lineWidthMultiple = 5; LineWidth = annot.LineWidth / 5; } else { LineWidth = annot.LineWidth; } if (point.Shape == "LineShape") { LineIsChecked = true; } if (point.Shape == "HookShape") { HookIsChecked = true; } if (point.Shape == "RectShape") { RectIsChecked = true; } if (point.Shape == "ForkShape") { ForkIsChecked = true; } IsUpDataCreate = false; SelectColor = new SolidColorBrush(annot.InkColor); IsUpDataCreate=true; FillOpacity = annot.Transparency; InitShapesType(point.Shape); Shape = point.Shape; } } } catch { } } } } } }