ShapFillPropertyViewModel.cs 26 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617618619620621622623624625626627628629630631632633634635636637638639640641642643644645646647648
  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. if (!fillAndSignContentViewModel.isFirst)
  133. {
  134. fillAndSignContentViewModel.LineWidth = value;
  135. //if (FillAndSignContentViewModel.IsEdit)
  136. {
  137. //PropertyPanel.UpdateAnnotAAttrib(AnnotAttrib.Height, 60);
  138. //PropertyPanel.UpdateAnnotAAttrib(AnnotAttrib.Width, 60);
  139. //if (Shape == "DotShape") { lineWidthMultiple = 5; }
  140. PropertyPanel.UpdateAnnotAAttrib(AnnotAttrib.Thickness, LineWidth * lineWidthMultiple);
  141. //fillAndSignContentViewModel.LineWidthMultiple = lineWidthMultiple;
  142. //PropertyPanel.UpdateAnnotAAttrib(AnnotAttrib.Path, updatapath);
  143. }
  144. // else
  145. {
  146. if (IsFillAndSign) { fillAndSignContentViewModel.SetStamp(); }
  147. }
  148. }
  149. }
  150. }
  151. public DelegateCommand<object> SelectedThickCommand { get; set; }
  152. public DelegateCommand<object> SelectedColorCommand { get; set; }
  153. //public DelegateCommand<object> LineStyleCommand { get; set; }
  154. public DelegateCommand<object> SharpsTypeCommand { get; set; }
  155. public DelegateCommand<object> ThicknessChangedCommand { get; set; }
  156. public DelegateCommand<object> SelectedOpacityValueCommand { get; set; }
  157. public ShapFillPropertyViewModel()
  158. {
  159. SelectedThickCommand = new DelegateCommand<object>(SelectedThick_Command);
  160. SelectedColorCommand = new DelegateCommand<object>(SelectedColor_Command);
  161. //LineStyleCommand = new DelegateCommand<object>(LineStyle_Command);
  162. SharpsTypeCommand = new DelegateCommand<object>(SharpsType_Command);
  163. ThicknessChangedCommand = new DelegateCommand<object>(ThicknessChanged_Command);
  164. SelectedOpacityValueCommand = new DelegateCommand<object>(SelectedOpacityValue);
  165. }
  166. private void InitFillAndSignProperty()
  167. {
  168. if (fillAndSignContentViewModel.isFirst)
  169. {
  170. SelectColor = fillAndSignContentViewModel.SelectColor;
  171. FillOpacity = fillAndSignContentViewModel.FillOpacity;
  172. LineWidth = fillAndSignContentViewModel.LineWidth;
  173. }
  174. fillAndSignContentViewModel.isFirst = false;
  175. }
  176. private DefaultAnnotProperty GetAnnotDefault(AnnotArgsType annotArgsType)
  177. {
  178. var Annot = SettingHelper.GetAnnotDefaultProperty(annotArgsType, "FillAndSign");
  179. if (Annot == null)
  180. {
  181. Annot = new DefaultAnnotProperty();
  182. Annot.AnnotToolType = annotArgsType;
  183. }
  184. return Annot;
  185. }
  186. private void SharpsType_Command(object obj)
  187. {
  188. if (obj != null)
  189. {
  190. var tag = (string)obj;
  191. SharpsType(tag, obj);
  192. }
  193. }
  194. private void SharpsType(string tag, object obj, bool isFromToolsBtn = false)
  195. {
  196. fillAndSignContentViewModel.LineWidthMultiple = 1;
  197. Dictionary<AnnotArgsType, object> changeData = new Dictionary<AnnotArgsType, object>();
  198. lineWidthMultiple = 1;
  199. //PropertyPanel.UpdateAnnotAAttrib(AnnotAttrib.Width, 60);
  200. //PropertyPanel.UpdateAnnotAAttrib(AnnotAttrib.Height, 60);
  201. switch (tag)
  202. {
  203. case "HookShape":
  204. var hookShape = new PathGeometry();
  205. hookShape.AddGeometry(Geometry.Parse("M0.599976 7.0286L5.57775 11.8L13.4 1.40002"));
  206. DataPath = hookShape;
  207. //if (FillAndSignContentViewModel.IsEdit)
  208. {
  209. PropertyPanel.UpdateAnnotAAttrib(AnnotAttrib.Thickness, LineWidth * fillAndSignContentViewModel.LineWidthMultiple);
  210. 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) } };
  211. PropertyPanel.UpdateAnnotAAttrib(AnnotAttrib.Path, updatapath);
  212. if (PropertyPanel.annotlists != null && PropertyPanel.annotlists.Count >= 1)
  213. {
  214. foreach (var annot in PropertyPanel.annotlists)
  215. {
  216. foreach (var point in fillAndSignContentViewModel.viewContentViewModel.FillAndSign)
  217. {
  218. if (annot.PageIndex == point.PageIndex && annot.AnnotIndex == point.AnnotIndex)
  219. {
  220. point.Shape = "HookShape";
  221. }
  222. }
  223. }
  224. }
  225. }
  226. //PropertyPanel.UpdateAnnotAAttrib();
  227. //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) } };
  228. //fillAndSignContentViewModel.SetStamp();
  229. //changeData[AnnotArgsType.AnnotLine] = tag;
  230. break;
  231. case "ForkShape":
  232. var forkShape = new PathGeometry();
  233. forkShape.AddGeometry(Geometry.Parse("M3.19995 3.20001L12.8 12.8 M12.8 3.20001L3.20005 12.8"));
  234. DataPath = forkShape;
  235. // if (FillAndSignContentViewModel.IsEdit)
  236. {
  237. PropertyPanel.UpdateAnnotAAttrib(AnnotAttrib.Thickness, LineWidth * fillAndSignContentViewModel.LineWidthMultiple);
  238. 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) } };
  239. PropertyPanel.UpdateAnnotAAttrib(AnnotAttrib.Path, updatapath);
  240. if (PropertyPanel.annotlists != null && PropertyPanel.annotlists.Count >= 1)
  241. {
  242. foreach (var annot in PropertyPanel.annotlists)
  243. {
  244. foreach (var point in fillAndSignContentViewModel.viewContentViewModel.FillAndSign)
  245. {
  246. if (annot.PageIndex == point.PageIndex && annot.AnnotIndex == point.AnnotIndex)
  247. {
  248. point.Shape = "ForkShape";
  249. }
  250. }
  251. }
  252. }
  253. }
  254. //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) } };
  255. //fillAndSignContentViewModel.SetStamp();
  256. //changeData[AnnotArgsType.AnnotLine] = tag;
  257. break;
  258. case "RectShape":
  259. {
  260. RectangleGeometry rectPath = new RectangleGeometry();
  261. rectPath.Rect = new Rect(0, 5, 28, 22);
  262. DataPath = rectPath;
  263. //if (FillAndSignContentViewModel.IsEdit)
  264. {
  265. PropertyPanel.UpdateAnnotAAttrib(AnnotAttrib.Thickness, LineWidth * fillAndSignContentViewModel.LineWidthMultiple);
  266. 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) } };
  267. PropertyPanel.UpdateAnnotAAttrib(AnnotAttrib.Path, updatapath);
  268. if (PropertyPanel.annotlists != null && PropertyPanel.annotlists.Count >= 1)
  269. {
  270. foreach (var annot in PropertyPanel.annotlists)
  271. {
  272. foreach (var point in fillAndSignContentViewModel.viewContentViewModel.FillAndSign)
  273. {
  274. if (annot.PageIndex == point.PageIndex && annot.AnnotIndex == point.AnnotIndex)
  275. {
  276. point.Shape = "RectShape";
  277. }
  278. }
  279. }
  280. }
  281. }
  282. //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) } };
  283. //fillAndSignContentViewModel.SetStamp();
  284. // changeData[AnnotArgsType.AnnotSquare] = tag;
  285. }
  286. break;
  287. case "LineShape":
  288. {
  289. var lineShape = new PathGeometry();
  290. lineShape.AddGeometry(Geometry.Parse(" M0,10L20,10"));
  291. DataPath = lineShape;
  292. // if (FillAndSignContentViewModel.IsEdit)
  293. {
  294. PropertyPanel.UpdateAnnotAAttrib(AnnotAttrib.Thickness, LineWidth * fillAndSignContentViewModel.LineWidthMultiple);
  295. updatapath = new List<List<Point>> { new List<Point> { new Point(3.19995, 3.20001), new Point(28, 3.20001) } };
  296. PropertyPanel.UpdateAnnotAAttrib(AnnotAttrib.Path, updatapath);
  297. if (PropertyPanel.annotlists != null && PropertyPanel.annotlists.Count >= 1)
  298. {
  299. foreach (var annot in PropertyPanel.annotlists)
  300. {
  301. foreach (var point in fillAndSignContentViewModel.viewContentViewModel.FillAndSign)
  302. {
  303. if (annot.PageIndex == point.PageIndex && annot.AnnotIndex == point.AnnotIndex)
  304. {
  305. point.Shape = "LineShape";
  306. }
  307. }
  308. }
  309. }
  310. }
  311. //fillAndSignContentViewModel.ShapePoints = new List<List<Point>> { new List<Point> { new Point(12.19995, 10), new Point(36, 10) } };
  312. //fillAndSignContentViewModel.SetStamp();
  313. //changeData[AnnotArgsType.AnnotLine] = tag;
  314. }
  315. break;
  316. case "DotShape":
  317. {
  318. //fillAndSignContentViewModel.LineWidthMultiple = 5;
  319. EllipseGeometry circlePath = new EllipseGeometry();
  320. circlePath.RadiusX = 2.4;
  321. circlePath.RadiusY = 2.4;
  322. circlePath.Center = new Point(2.4, 2.4);
  323. DataPath = circlePath;
  324. // if (FillAndSignContentViewModel.IsEdit)
  325. {
  326. lineWidthMultiple = 5;
  327. updatapath = new List<List<Point>> { new List<Point> { new Point(3.19995, 3.19995), new Point(3.19995, 3.19995) } };
  328. PropertyPanel.UpdateAnnotAAttrib(AnnotAttrib.Thickness, LineWidth * 5);
  329. PropertyPanel.UpdateAnnotAAttrib(AnnotAttrib.Path, updatapath);
  330. if (PropertyPanel.annotlists != null && PropertyPanel.annotlists.Count >= 1)
  331. {
  332. foreach (var annot in PropertyPanel.annotlists)
  333. {
  334. foreach (var point in fillAndSignContentViewModel.viewContentViewModel.FillAndSign)
  335. {
  336. if (annot.PageIndex == point.PageIndex && annot.AnnotIndex == point.AnnotIndex)
  337. {
  338. point.Shape = "DotShape";
  339. }
  340. }
  341. }
  342. }
  343. }
  344. //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) } };
  345. //fillAndSignContentViewModel.SetStamp();
  346. //changeData[AnnotArgsType.AnnotCircle] = tag;
  347. }
  348. break;
  349. }
  350. //if (isFromToolsBtn == false)
  351. // PropertyPanel.AnnotTypeChangedInvoke(this, changeData);
  352. }
  353. private string UPDateShapeType(string tag)
  354. {
  355. switch (tag)
  356. {
  357. case "DotShape":
  358. return "Dot";
  359. break;
  360. case "LineShape":
  361. return "Line";
  362. break;
  363. case "RectShape":
  364. return "Rectangle";
  365. break;
  366. case "ForkShape":
  367. return "Fork";
  368. break;
  369. case "HookShape":
  370. return "Hook";
  371. break;
  372. default:
  373. return "General Properties";
  374. break;
  375. }
  376. }
  377. private void InitShapesType(string tag)
  378. {
  379. ShapeType = UPDateShapeType(tag);
  380. fillAndSignContentViewModel.LineWidthMultiple = 1;
  381. switch (tag)
  382. {
  383. case "HookShape":
  384. var hookShape = new PathGeometry();
  385. hookShape.AddGeometry(Geometry.Parse("M0.599976 7.0286L5.57775 11.8L13.4 1.40002"));
  386. DataPath = hookShape;
  387. break;
  388. case "ForkShape":
  389. var forkShape = new PathGeometry();
  390. forkShape.AddGeometry(Geometry.Parse("M3.19995 3.20001L12.8 12.8 M12.8 3.20001L3.20005 12.8"));
  391. DataPath = forkShape;
  392. break;
  393. case "RectShape":
  394. {
  395. RectangleGeometry rectPath = new RectangleGeometry();
  396. rectPath.Rect = new Rect(0, 5, 28, 22);
  397. DataPath = rectPath;
  398. }
  399. break;
  400. case "LineShape":
  401. {
  402. var lineShape = new PathGeometry();
  403. lineShape.AddGeometry(Geometry.Parse(" M0,10L20,10"));
  404. DataPath = lineShape;
  405. }
  406. break;
  407. case "DotShape":
  408. {
  409. //fillAndSignContentViewModel.LineWidthMultiple = 5;
  410. EllipseGeometry circlePath = new EllipseGeometry();
  411. circlePath.RadiusX = 2.4;
  412. circlePath.RadiusY = 2.4;
  413. circlePath.Center = new Point(2.4, 2.4);
  414. DataPath = circlePath;
  415. }
  416. break;
  417. }
  418. //if (isFromToolsBtn == false)
  419. // PropertyPanel.AnnotTypeChangedInvoke(this, changeData);
  420. }
  421. private void SelectedThick_Command(object obj)
  422. {
  423. if (obj is double)
  424. {
  425. var tran = (double)obj;
  426. //BorderOpacity = tran;
  427. SelectColor.Opacity = tran;
  428. //AnnotEvent?.UpdateAttrib(AnnotAttrib.Transparency, tran);
  429. //AnnotEvent?.UpdateAnnot();
  430. }
  431. }
  432. private void ThicknessChanged_Command(object obj)
  433. {
  434. if (obj != null)
  435. {
  436. var item = (ComboBoxItem)obj;
  437. var content = (string)item.Content;
  438. if (content != null)
  439. {
  440. var intData = int.Parse(content);
  441. LineWidth = intData;
  442. }
  443. }
  444. }
  445. private void SelectedColor_Command(object obj)
  446. {
  447. if (obj != null)
  448. {
  449. var colorValue = (Color)obj;
  450. if (colorValue != null)
  451. {
  452. SelectColor = new SolidColorBrush(colorValue);
  453. SelectColor.Opacity = FillOpacity;
  454. Dictionary<AnnotArgsType, object> changeData = new Dictionary<AnnotArgsType, object>();
  455. changeData[AnnotArgsType.AnnotFreehand] = obj;
  456. //PropertyPanel.DataChangedInvoke(this, changeData);
  457. }
  458. }
  459. }
  460. private void SelectedOpacityValue(object obj)
  461. {
  462. if (obj != null)
  463. {
  464. FillOpacity = (double)obj;
  465. SelectColor.Opacity = FillOpacity;
  466. //AnnotEvent?.UpdateAttrib(AnnotAttrib.Transparency, FillOpacity);
  467. //AnnotEvent?.UpdateAnnot();
  468. Dictionary<AnnotArgsType, object> changeData = new Dictionary<AnnotArgsType, object>();
  469. changeData[AnnotArgsType.AnnotFreehand] = FillOpacity;
  470. //PropertyPanel.DataChangedInvoke(this, changeData);
  471. }
  472. }
  473. private void BindingPDFViewerHandler()
  474. {
  475. //来自PDFViewer的响应事件
  476. if (fillAndSignContentViewModel.PDFViewer != null)
  477. {
  478. fillAndSignContentViewModel.PDFViewer.AnnotActiveHandler -= PDFViewer_AnnotActiveHandler;
  479. fillAndSignContentViewModel.PDFViewer.AnnotActiveHandler += PDFViewer_AnnotActiveHandler;
  480. }
  481. }
  482. private void UnBindingPDFViewerHandler()
  483. {
  484. if (fillAndSignContentViewModel.PDFViewer != null)
  485. {
  486. fillAndSignContentViewModel.PDFViewer.AnnotActiveHandler -= PDFViewer_AnnotActiveHandler;
  487. }
  488. }
  489. private void PDFViewer_AnnotActiveHandler(object sender, AnnotAttribEvent e)
  490. {
  491. if (e != null) { }
  492. else
  493. {
  494. if (fillAndSignContentViewModel.PDFViewer.MouseMode == MouseModes.AnnotCreate) { IsSelected = true; }
  495. }
  496. }
  497. public bool IsNavigationTarget(NavigationContext navigationContext)
  498. {
  499. return true;
  500. }
  501. public void OnNavigatedFrom(NavigationContext navigationContext)
  502. {
  503. UnBindingPDFViewerHandler();
  504. }
  505. public void OnNavigatedTo(NavigationContext navigationContext)
  506. {
  507. string shape = "";
  508. navigationContext.Parameters.TryGetValue<AnnotTransfer>(ParameterNames.PropertyPanelContentViewModel, out PropertyPanel);
  509. navigationContext.Parameters.TryGetValue<FillAndSignContentViewModel>("FillAndSignContentViewModel", out fillAndSignContentViewModel);
  510. navigationContext.Parameters.TryGetValue<string>("Shape", out shape);
  511. bool isFillAndSign = false;
  512. navigationContext.Parameters.TryGetValue<bool>("IsFillAndSign", out isFillAndSign);
  513. IsFillAndSign = isFillAndSign;
  514. InitShapesType(shape);
  515. //FillAndSignContentViewModel.IsEdit = false;
  516. if (PropertyPanel != null)
  517. {
  518. AnnotEvent = PropertyPanel.AnnotEvent;
  519. Annot = PropertyPanel.annot;
  520. var stampAnnotArgs = Annot as StampAnnotArgs;
  521. if (PropertyPanel.annotlists != null && PropertyPanel.annotlists.Count > 1)
  522. {
  523. IsMultiSelected = true;
  524. }
  525. else
  526. {
  527. IsMultiSelected = false;
  528. }
  529. IsSelected = !FillAndSignContentViewModel.IsEdit;
  530. InitFillAndSignProperty();
  531. if (IsMultiSelected)
  532. {
  533. }
  534. else
  535. {
  536. GetAnnotProperty(shape);
  537. }
  538. BindingPDFViewerHandler();
  539. }
  540. }
  541. private void GetAnnotProperty(string shape)
  542. {
  543. if (Annot is FreehandAnnotArgs)
  544. {
  545. var annot = Annot as FreehandAnnotArgs;
  546. if (annot != null)
  547. {
  548. //SelectColor = new SolidColorBrush(annot.InkColor);
  549. //FillOpacity = annot.Transparency;
  550. foreach (var point in fillAndSignContentViewModel.viewContentViewModel.FillAndSign)
  551. {
  552. if (annot.PageIndex == point.PageIndex && annot.AnnotIndex == point.AnnotIndex)
  553. {
  554. lineWidthMultiple = 1;
  555. if (point.Shape == "DotShape")
  556. {
  557. lineWidthMultiple = 5;
  558. }
  559. InitShapesType(point.Shape);
  560. Shape = point.Shape;
  561. }
  562. }
  563. }
  564. }
  565. }
  566. }
  567. }