ShapFillPropertyViewModel.cs 27 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617618619620621622623624625626627628629630631632633634635636637638639640641642643644645646647648649650651652653654655656657658659660661662663664665666667668669670671672673674675676677678679680681682683684
  1. using ComPDFKitViewer.AnnotEvent;
  2. using ComPDFKitViewer;
  3. using Prism.Mvvm;
  4. using Prism.Regions;
  5. using System;
  6. using System.Collections.Generic;
  7. using System.Linq;
  8. using System.Text;
  9. using System.Threading.Tasks;
  10. using System.Windows;
  11. using System.Windows.Media;
  12. using Prism.Commands;
  13. using System.Windows.Controls;
  14. using ComPDFKit.PDFAnnotation;
  15. using PDF_Master.Helper;
  16. using System.Diagnostics;
  17. using PDF_Master.Model;
  18. using PDF_Master.ViewModels.Tools;
  19. using Microsoft.Office.Interop.Excel;
  20. using Point = System.Windows.Point;
  21. using static Dropbox.Api.UsersCommon.AccountType;
  22. using PDF_Master.Model.AnnotPanel;
  23. using PDFSettings;
  24. using PDF_Master.ViewModels.Tools.AnnotManager;
  25. using Prism.Common;
  26. using ComPDFKitViewer.PdfViewer;
  27. namespace PDF_Master.ViewModels.FillAndSign.PropertyPanel
  28. {
  29. public class ShapFillPropertyViewModel : BindableBase, INavigationAware
  30. {
  31. public AnnotAttribEvent AnnotEvent { get; set; }
  32. private AnnotHandlerEventArgs Annot;
  33. private AnnotTransfer PropertyPanel;
  34. private FillAndSignContentViewModel fillAndSignContentViewModel;
  35. public List<List<Point>> updatapath = new List<List<Point>>();
  36. private Geometry dataPath = null;
  37. private bool IsFillAndSign = false;
  38. public string shape = "";
  39. public string Shape
  40. {
  41. get { return shape; }
  42. set
  43. {
  44. SetProperty(ref shape, value);
  45. }
  46. }
  47. public string shapeType = "";
  48. public string ShapeType
  49. {
  50. get { return shapeType; }
  51. set
  52. {
  53. SetProperty(ref shapeType, value);
  54. }
  55. }
  56. public Geometry DataPath
  57. {
  58. get { return dataPath; }
  59. set
  60. {
  61. SetProperty(ref dataPath, value);
  62. }
  63. }
  64. private void InitColorItems()
  65. {
  66. }
  67. private Brush selectColor = new SolidColorBrush(Colors.GreenYellow);
  68. public Brush SelectColor
  69. {
  70. get { return selectColor; }
  71. set
  72. {
  73. SetProperty(ref selectColor, value);
  74. //if (!fillAndSignContentViewModel.isFirst)
  75. //{
  76. // fillAndSignContentViewModel.SelectColor = value;
  77. // //if (FillAndSignContentViewModel.IsEdit)
  78. // {
  79. // // PropertyPanel.UpdateAnnotAAttrib(AnnotAttrib.Thickness, LineWidth * lineWidthMultiple);
  80. // PropertyPanel.UpdateAnnotAAttrib(AnnotAttrib.Color, (selectColor as SolidColorBrush).Color);
  81. // }
  82. // //else
  83. // {
  84. // if (IsFillAndSign) { fillAndSignContentViewModel.SetStamp(); }
  85. // }
  86. //}
  87. }
  88. }
  89. private double fillOpacity = 1;
  90. public double FillOpacity
  91. {
  92. get { return fillOpacity; }
  93. set
  94. {
  95. SetProperty(ref fillOpacity, value);
  96. //if (!fillAndSignContentViewModel.isFirst)
  97. //{
  98. // fillAndSignContentViewModel.FillOpacity = value;
  99. // //if (FillAndSignContentViewModel.IsEdit)
  100. // {
  101. // PropertyPanel.UpdateAnnotAAttrib(AnnotAttrib.Transparency, fillOpacity);
  102. // }
  103. // //else
  104. // {
  105. // if (IsFillAndSign) { fillAndSignContentViewModel.SetStamp(); }
  106. // }
  107. //}
  108. }
  109. }
  110. private bool _isMultiSelected = false;
  111. public bool IsMultiSelected
  112. {
  113. get { return _isMultiSelected; }
  114. set { SetProperty(ref _isMultiSelected, value);
  115. if (value) { ShapeType = "General Properties"; }
  116. }
  117. }
  118. private bool _isSelected = false;
  119. public bool IsSelected
  120. {
  121. get { return _isSelected; }
  122. set => SetProperty(ref _isSelected, value);
  123. }
  124. private double lineWidthMultiple = 1;
  125. private double lineWidth = 1;
  126. public double LineWidth
  127. {
  128. get { return lineWidth; }
  129. set
  130. {
  131. SetProperty(ref lineWidth, value);
  132. UPDataLineWidth();
  133. }
  134. }
  135. public DelegateCommand<object> SelectedThickCommand { get; set; }
  136. public DelegateCommand<object> SelectedColorCommand { get; set; }
  137. //public DelegateCommand<object> LineStyleCommand { get; set; }
  138. public DelegateCommand<object> SharpsTypeCommand { get; set; }
  139. public DelegateCommand<object> ThicknessChangedCommand { get; set; }
  140. public DelegateCommand<object> SelectedOpacityValueCommand { get; set; }
  141. public ShapFillPropertyViewModel()
  142. {
  143. SelectedThickCommand = new DelegateCommand<object>(SelectedThick_Command);
  144. SelectedColorCommand = new DelegateCommand<object>(SelectedColor_Command);
  145. //LineStyleCommand = new DelegateCommand<object>(LineStyle_Command);
  146. SharpsTypeCommand = new DelegateCommand<object>(SharpsType_Command);
  147. ThicknessChangedCommand = new DelegateCommand<object>(ThicknessChanged_Command);
  148. SelectedOpacityValueCommand = new DelegateCommand<object>(SelectedOpacityValue);
  149. }
  150. private void InitFillAndSignProperty()
  151. {
  152. if (fillAndSignContentViewModel.isFirst)
  153. {
  154. SelectColor = fillAndSignContentViewModel.SelectColor;
  155. FillOpacity = fillAndSignContentViewModel.FillOpacity;
  156. LineWidth = fillAndSignContentViewModel.LineWidth;
  157. }
  158. fillAndSignContentViewModel.isFirst = false;
  159. }
  160. private DefaultAnnotProperty GetAnnotDefault(AnnotArgsType annotArgsType)
  161. {
  162. var Annot = SettingHelper.GetAnnotDefaultProperty(annotArgsType, "FillAndSign");
  163. if (Annot == null)
  164. {
  165. Annot = new DefaultAnnotProperty();
  166. Annot.AnnotToolType = annotArgsType;
  167. }
  168. return Annot;
  169. }
  170. private void SharpsType_Command(object obj)
  171. {
  172. if (obj != null)
  173. {
  174. var tag = (string)obj;
  175. SharpsType(tag, obj);
  176. }
  177. }
  178. private void SharpsType(string tag, object obj, bool isFromToolsBtn = false)
  179. {
  180. fillAndSignContentViewModel.LineWidthMultiple = 1;
  181. Dictionary<AnnotArgsType, object> changeData = new Dictionary<AnnotArgsType, object>();
  182. lineWidthMultiple = 1;
  183. //PropertyPanel.UpdateAnnotAAttrib(AnnotAttrib.Width, 60);
  184. //PropertyPanel.UpdateAnnotAAttrib(AnnotAttrib.Height, 60);
  185. switch (tag)
  186. {
  187. case "HookShape":
  188. var hookShape = new PathGeometry();
  189. hookShape.AddGeometry(Geometry.Parse("M0.599976 7.0286L5.57775 11.8L13.4 1.40002"));
  190. DataPath = hookShape;
  191. //if (FillAndSignContentViewModel.IsEdit)
  192. {
  193. PropertyPanel.UpdateAnnotAAttrib(AnnotAttrib.Thickness, LineWidth * fillAndSignContentViewModel.LineWidthMultiple);
  194. updatapath = fillAndSignContentViewModel.keyShape[tag];
  195. PropertyPanel.UpdateAnnotAAttrib(AnnotAttrib.Path, updatapath);
  196. if (PropertyPanel.annotlists != null && PropertyPanel.annotlists.Count >= 1)
  197. {
  198. foreach (var annot in PropertyPanel.annotlists)
  199. {
  200. foreach (var point in fillAndSignContentViewModel.viewContentViewModel.FillAndSign)
  201. {
  202. if (annot.PageIndex == point.PageIndex && annot.AnnotIndex == point.AnnotIndex)
  203. {
  204. point.Shape = "HookShape";
  205. }
  206. }
  207. }
  208. }
  209. }
  210. //PropertyPanel.UpdateAnnotAAttrib();
  211. //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) } };
  212. //fillAndSignContentViewModel.SetStamp();
  213. //changeData[AnnotArgsType.AnnotLine] = tag;
  214. break;
  215. case "ForkShape":
  216. var forkShape = new PathGeometry();
  217. forkShape.AddGeometry(Geometry.Parse("M3.19995 3.20001L12.8 12.8 M12.8 3.20001L3.20005 12.8"));
  218. DataPath = forkShape;
  219. // if (FillAndSignContentViewModel.IsEdit)
  220. {
  221. PropertyPanel.UpdateAnnotAAttrib(AnnotAttrib.Thickness, LineWidth * fillAndSignContentViewModel.LineWidthMultiple);
  222. updatapath = fillAndSignContentViewModel.keyShape[tag];
  223. PropertyPanel.UpdateAnnotAAttrib(AnnotAttrib.Path, updatapath);
  224. if (PropertyPanel.annotlists != null && PropertyPanel.annotlists.Count >= 1)
  225. {
  226. foreach (var annot in PropertyPanel.annotlists)
  227. {
  228. foreach (var point in fillAndSignContentViewModel.viewContentViewModel.FillAndSign)
  229. {
  230. if (annot.PageIndex == point.PageIndex && annot.AnnotIndex == point.AnnotIndex)
  231. {
  232. point.Shape = "ForkShape";
  233. }
  234. }
  235. }
  236. }
  237. }
  238. //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) } };
  239. //fillAndSignContentViewModel.SetStamp();
  240. //changeData[AnnotArgsType.AnnotLine] = tag;
  241. break;
  242. case "RectShape":
  243. {
  244. RectangleGeometry rectPath = new RectangleGeometry();
  245. rectPath.Rect = new Rect(0, 5, 28, 22);
  246. DataPath = rectPath;
  247. //if (FillAndSignContentViewModel.IsEdit)
  248. {
  249. PropertyPanel.UpdateAnnotAAttrib(AnnotAttrib.Thickness, LineWidth * fillAndSignContentViewModel.LineWidthMultiple);
  250. updatapath = fillAndSignContentViewModel.keyShape[tag];
  251. PropertyPanel.UpdateAnnotAAttrib(AnnotAttrib.Path, updatapath);
  252. if (PropertyPanel.annotlists != null && PropertyPanel.annotlists.Count >= 1)
  253. {
  254. foreach (var annot in PropertyPanel.annotlists)
  255. {
  256. foreach (var point in fillAndSignContentViewModel.viewContentViewModel.FillAndSign)
  257. {
  258. if (annot.PageIndex == point.PageIndex && annot.AnnotIndex == point.AnnotIndex)
  259. {
  260. point.Shape = "RectShape";
  261. }
  262. }
  263. }
  264. }
  265. }
  266. //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) } };
  267. //fillAndSignContentViewModel.SetStamp();
  268. // changeData[AnnotArgsType.AnnotSquare] = tag;
  269. }
  270. break;
  271. case "LineShape":
  272. {
  273. var lineShape = new PathGeometry();
  274. lineShape.AddGeometry(Geometry.Parse(" M0,10L20,10"));
  275. DataPath = lineShape;
  276. // if (FillAndSignContentViewModel.IsEdit)
  277. {
  278. PropertyPanel.UpdateAnnotAAttrib(AnnotAttrib.Thickness, LineWidth * fillAndSignContentViewModel.LineWidthMultiple);
  279. updatapath = fillAndSignContentViewModel.keyShape[tag];
  280. PropertyPanel.UpdateAnnotAAttrib(AnnotAttrib.Path, updatapath);
  281. if (PropertyPanel.annotlists != null && PropertyPanel.annotlists.Count >= 1)
  282. {
  283. foreach (var annot in PropertyPanel.annotlists)
  284. {
  285. foreach (var point in fillAndSignContentViewModel.viewContentViewModel.FillAndSign)
  286. {
  287. if (annot.PageIndex == point.PageIndex && annot.AnnotIndex == point.AnnotIndex)
  288. {
  289. point.Shape = "LineShape";
  290. }
  291. }
  292. }
  293. }
  294. }
  295. //fillAndSignContentViewModel.ShapePoints = new List<List<Point>> { new List<Point> { new Point(12.19995, 10), new Point(36, 10) } };
  296. //fillAndSignContentViewModel.SetStamp();
  297. //changeData[AnnotArgsType.AnnotLine] = tag;
  298. }
  299. break;
  300. case "DotShape":
  301. {
  302. //fillAndSignContentViewModel.LineWidthMultiple = 5;
  303. EllipseGeometry circlePath = new EllipseGeometry();
  304. circlePath.RadiusX = 2.4;
  305. circlePath.RadiusY = 2.4;
  306. circlePath.Center = new Point(2.4, 2.4);
  307. DataPath = circlePath;
  308. // if (FillAndSignContentViewModel.IsEdit)
  309. {
  310. lineWidthMultiple = 5;
  311. updatapath = fillAndSignContentViewModel.keyShape[tag];
  312. PropertyPanel.UpdateAnnotAAttrib(AnnotAttrib.Thickness, LineWidth * 5);
  313. PropertyPanel.UpdateAnnotAAttrib(AnnotAttrib.Path, updatapath);
  314. if (PropertyPanel.annotlists != null && PropertyPanel.annotlists.Count >= 1)
  315. {
  316. foreach (var annot in PropertyPanel.annotlists)
  317. {
  318. foreach (var point in fillAndSignContentViewModel.viewContentViewModel.FillAndSign)
  319. {
  320. if (annot.PageIndex == point.PageIndex && annot.AnnotIndex == point.AnnotIndex)
  321. {
  322. point.Shape = "DotShape";
  323. }
  324. }
  325. }
  326. }
  327. }
  328. //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) } };
  329. //fillAndSignContentViewModel.SetStamp();
  330. //changeData[AnnotArgsType.AnnotCircle] = tag;
  331. }
  332. break;
  333. }
  334. //if (isFromToolsBtn == false)
  335. // PropertyPanel.AnnotTypeChangedInvoke(this, changeData);
  336. }
  337. private string UPDateShapeType(string tag)
  338. {
  339. switch (tag)
  340. {
  341. case "DotShape":
  342. return "Dot";
  343. case "LineShape":
  344. return "Line";
  345. case "RectShape":
  346. return "Rectangle";
  347. case "ForkShape":
  348. return "Fork";
  349. case "HookShape":
  350. return "Hook";
  351. default:
  352. return "General Properties";
  353. }
  354. }
  355. private void InitShapesType(string tag)
  356. {
  357. ShapeType = UPDateShapeType(tag);
  358. fillAndSignContentViewModel.LineWidthMultiple = 1;
  359. switch (tag)
  360. {
  361. case "HookShape":
  362. var hookShape = new PathGeometry();
  363. hookShape.AddGeometry(Geometry.Parse("M0.599976 7.0286L5.57775 11.8L13.4 1.40002"));
  364. DataPath = hookShape;
  365. break;
  366. case "ForkShape":
  367. var forkShape = new PathGeometry();
  368. forkShape.AddGeometry(Geometry.Parse("M3.19995 3.20001L12.8 12.8 M12.8 3.20001L3.20005 12.8"));
  369. DataPath = forkShape;
  370. break;
  371. case "RectShape":
  372. {
  373. RectangleGeometry rectPath = new RectangleGeometry();
  374. rectPath.Rect = new Rect(0, 5, 28, 22);
  375. DataPath = rectPath;
  376. }
  377. break;
  378. case "LineShape":
  379. {
  380. var lineShape = new PathGeometry();
  381. lineShape.AddGeometry(Geometry.Parse(" M0,10L20,10"));
  382. DataPath = lineShape;
  383. }
  384. break;
  385. case "DotShape":
  386. {
  387. //fillAndSignContentViewModel.LineWidthMultiple = 5;
  388. EllipseGeometry circlePath = new EllipseGeometry();
  389. circlePath.RadiusX = 2.4;
  390. circlePath.RadiusY = 2.4;
  391. circlePath.Center = new Point(2.4, 2.4);
  392. DataPath = circlePath;
  393. }
  394. break;
  395. }
  396. //if (isFromToolsBtn == false)
  397. // PropertyPanel.AnnotTypeChangedInvoke(this, changeData);
  398. }
  399. private void SelectedThick_Command(object obj)
  400. {
  401. if (obj is double)
  402. {
  403. var tran = (double)obj;
  404. //BorderOpacity = tran;
  405. SelectColor.Opacity = tran;
  406. //AnnotEvent?.UpdateAttrib(AnnotAttrib.Transparency, tran);
  407. //AnnotEvent?.UpdateAnnot();
  408. }
  409. }
  410. private void ThicknessChanged_Command(object obj)
  411. {
  412. if (obj != null)
  413. {
  414. var item = (ComboBoxItem)obj;
  415. var content = (string)item.Content;
  416. if (content != null)
  417. {
  418. var intData = int.Parse(content);
  419. LineWidth = intData;
  420. UPDataLineWidth();
  421. }
  422. }
  423. }
  424. private void UPDataLineWidth(){
  425. if (!fillAndSignContentViewModel.isFirst)
  426. {
  427. fillAndSignContentViewModel.LineWidth = LineWidth;
  428. //if (FillAndSignContentViewModel.IsEdit)
  429. {
  430. PropertyPanel.UpdateAnnotAAttrib(AnnotAttrib.Thickness, LineWidth * lineWidthMultiple);
  431. }
  432. // else
  433. {
  434. if (IsFillAndSign) { fillAndSignContentViewModel.SetStamp(); }
  435. }
  436. }
  437. }
  438. private void UPDataColor()
  439. {
  440. if (!fillAndSignContentViewModel.isFirst)
  441. {
  442. fillAndSignContentViewModel.SelectColor = SelectColor;
  443. //if (FillAndSignContentViewModel.IsEdit)
  444. {
  445. // PropertyPanel.UpdateAnnotAAttrib(AnnotAttrib.Thickness, LineWidth * lineWidthMultiple);
  446. PropertyPanel.UpdateAnnotAAttrib(AnnotAttrib.Color, (selectColor as SolidColorBrush).Color);
  447. }
  448. //else
  449. {
  450. if (IsFillAndSign) { fillAndSignContentViewModel.SetStamp(); }
  451. }
  452. }
  453. }
  454. private void UPDataOpacity()
  455. {
  456. if (!fillAndSignContentViewModel.isFirst)
  457. {
  458. fillAndSignContentViewModel.FillOpacity = FillOpacity;
  459. //if (FillAndSignContentViewModel.IsEdit)
  460. {
  461. PropertyPanel.UpdateAnnotAAttrib(AnnotAttrib.Transparency, fillOpacity);
  462. }
  463. //else
  464. {
  465. if (IsFillAndSign) { fillAndSignContentViewModel.SetStamp(); }
  466. }
  467. }
  468. }
  469. private void SelectedColor_Command(object obj)
  470. {
  471. if (obj != null)
  472. {
  473. var colorValue = (Color)obj;
  474. if (colorValue != null)
  475. {
  476. SelectColor = new SolidColorBrush(colorValue);
  477. UPDataColor();
  478. SelectColor.Opacity = FillOpacity;
  479. Dictionary<AnnotArgsType, object> changeData = new Dictionary<AnnotArgsType, object>();
  480. changeData[AnnotArgsType.AnnotFreehand] = obj;
  481. //PropertyPanel.DataChangedInvoke(this, changeData);
  482. }
  483. }
  484. }
  485. private void SelectedOpacityValue(object obj)
  486. {
  487. if (obj != null)
  488. {
  489. FillOpacity = (double)obj;
  490. SelectColor.Opacity = FillOpacity;
  491. UPDataOpacity();
  492. //AnnotEvent?.UpdateAttrib(AnnotAttrib.Transparency, FillOpacity);
  493. //AnnotEvent?.UpdateAnnot();
  494. Dictionary<AnnotArgsType, object> changeData = new Dictionary<AnnotArgsType, object>();
  495. changeData[AnnotArgsType.AnnotFreehand] = FillOpacity;
  496. //PropertyPanel.DataChangedInvoke(this, changeData);
  497. }
  498. }
  499. private void BindingPDFViewerHandler()
  500. {
  501. //来自PDFViewer的响应事件
  502. if (fillAndSignContentViewModel.PDFViewer != null)
  503. {
  504. fillAndSignContentViewModel.PDFViewer.AnnotActiveHandler -= PDFViewer_AnnotActiveHandler;
  505. fillAndSignContentViewModel.PDFViewer.AnnotActiveHandler += PDFViewer_AnnotActiveHandler;
  506. }
  507. }
  508. private void UnBindingPDFViewerHandler()
  509. {
  510. if (fillAndSignContentViewModel.PDFViewer != null)
  511. {
  512. fillAndSignContentViewModel.PDFViewer.AnnotActiveHandler -= PDFViewer_AnnotActiveHandler;
  513. }
  514. }
  515. private void PDFViewer_AnnotActiveHandler(object sender, AnnotAttribEvent e)
  516. {
  517. if (e != null) { }
  518. else
  519. {
  520. if (fillAndSignContentViewModel.PDFViewer.MouseMode == MouseModes.AnnotCreate) { IsSelected = true; }
  521. }
  522. }
  523. public bool IsNavigationTarget(NavigationContext navigationContext)
  524. {
  525. return true;
  526. }
  527. public void OnNavigatedFrom(NavigationContext navigationContext)
  528. {
  529. UnBindingPDFViewerHandler();
  530. }
  531. public void OnNavigatedTo(NavigationContext navigationContext)
  532. {
  533. string shape = "";
  534. navigationContext.Parameters.TryGetValue<AnnotTransfer>(ParameterNames.PropertyPanelContentViewModel, out PropertyPanel);
  535. navigationContext.Parameters.TryGetValue<FillAndSignContentViewModel>("FillAndSignContentViewModel", out fillAndSignContentViewModel);
  536. navigationContext.Parameters.TryGetValue<string>("Shape", out shape);
  537. bool isFillAndSign = false;
  538. navigationContext.Parameters.TryGetValue<bool>("IsFillAndSign", out isFillAndSign);
  539. IsFillAndSign = isFillAndSign;
  540. InitShapesType(shape);
  541. //FillAndSignContentViewModel.IsEdit = false;
  542. if (PropertyPanel != null)
  543. {
  544. AnnotEvent = PropertyPanel.AnnotEvent;
  545. Annot = PropertyPanel.annot;
  546. var stampAnnotArgs = Annot as StampAnnotArgs;
  547. if (PropertyPanel.annotlists != null && PropertyPanel.annotlists.Count > 1)
  548. {
  549. IsMultiSelected = true;
  550. }
  551. else
  552. {
  553. IsMultiSelected = false;
  554. }
  555. IsSelected = !FillAndSignContentViewModel.IsEdit;
  556. InitFillAndSignProperty();
  557. if (IsMultiSelected)
  558. {
  559. }
  560. else
  561. {
  562. GetAnnotProperty(shape);
  563. }
  564. BindingPDFViewerHandler();
  565. }
  566. }
  567. private void GetAnnotProperty(string shape)
  568. {
  569. if (Annot is FreehandAnnotArgs)
  570. {
  571. var annot = Annot as FreehandAnnotArgs;
  572. if (annot != null)
  573. {
  574. //SelectColor = new SolidColorBrush(annot.InkColor);
  575. //FillOpacity = annot.Transparency;
  576. //LineWidth = annot.LineWidth;
  577. foreach (var point in fillAndSignContentViewModel.viewContentViewModel.FillAndSign)
  578. {
  579. if (annot.PageIndex == point.PageIndex && annot.AnnotIndex == point.AnnotIndex)
  580. {
  581. lineWidthMultiple = 1;
  582. if (point.Shape == "DotShape")
  583. {
  584. lineWidthMultiple = 5;
  585. }
  586. InitShapesType(point.Shape);
  587. Shape = point.Shape;
  588. }
  589. }
  590. }
  591. }
  592. }
  593. }
  594. }