AnnotToolContentViewModel.Properties.cs 5.6 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181
  1. using ComPDFKitViewer.AnnotEvent;
  2. using ComPDFKitViewer.PdfViewer;
  3. using PDF_Office.CustomControl;
  4. using PDF_Office.ViewModels.PropertyPanel.AnnotPanel;
  5. using Prism.Commands;
  6. using Prism.Events;
  7. using Prism.Regions;
  8. using Prism.Services.Dialogs;
  9. using System;
  10. using System.Collections.Generic;
  11. using System.Linq;
  12. using System.Text;
  13. using System.Threading.Tasks;
  14. using System.Windows.Media;
  15. namespace PDF_Office.ViewModels.Tools
  16. {
  17. /// <summary>
  18. /// 改变工具栏注释属性值,主要用来传参数:注释属性和同步工具栏对应图标的属性(颜色)
  19. /// </summary>
  20. public class AnnotPropertyPanel
  21. {
  22. public AnnotAttribEvent AnnotEvent { get; set; }
  23. public List<AnnotAttribEvent> AnnotEvents = new List<AnnotAttribEvent>();
  24. public AnnotHandlerEventArgs annot;
  25. public List<AnnotHandlerEventArgs> annotlists;
  26. public event EventHandler<Dictionary<AnnotArgsType, object>> DataChanged;
  27. public event EventHandler<Dictionary<AnnotArgsType, object>> AnnotTypeChanged;
  28. public event EventHandler<object> DefaultStored;
  29. public AnnotPropertyPanel()
  30. { }
  31. /// <summary>
  32. /// 触发到工具栏注释工具,改变工具图标下的颜色值
  33. /// </summary>
  34. /// <param name="sender"></param>
  35. /// <param name="keyValues"></param>
  36. public void DataChangedInvoke(object sender, Dictionary<AnnotArgsType, object> keyValues)
  37. {
  38. DataChanged?.Invoke(sender, keyValues);
  39. }
  40. public void AnnotTypeChangedInvoke(object sender, Dictionary<AnnotArgsType, object> keyValues)
  41. {
  42. AnnotTypeChanged?.Invoke(sender, keyValues);
  43. }
  44. }
  45. public sealed partial class AnnotToolContentViewModel
  46. {
  47. #region 属性
  48. #region 注释工具
  49. //高亮
  50. private Brush highLightColor = new SolidColorBrush(Color.FromRgb(0xFF, 0xBB, 0x00));
  51. public Brush HighLightColor
  52. { get { return highLightColor; } set { SetProperty(ref highLightColor, value); } }
  53. //
  54. private double highLightOpacity = 1;
  55. public double HighLightOpacity
  56. { get { return highLightOpacity; } set { SetProperty(ref highLightOpacity, value); } }
  57. //
  58. private Brush underLine = new SolidColorBrush(Color.FromRgb(0xFF, 0xBB, 0x00));
  59. public Brush UnderLineColor
  60. { get { return underLine; } set { SetProperty(ref underLine, value); } }
  61. //
  62. private double underLineOpacity = 1;
  63. public double UnderLineOpacity
  64. { get { return underLineOpacity; } set { SetProperty(ref underLineOpacity, value); } }
  65. //
  66. private Brush squigglyColor = new SolidColorBrush(Color.FromRgb(0xFF, 0xBB, 0x00));
  67. public Brush SquigglyColor
  68. { get { return squigglyColor; } set { SetProperty(ref squigglyColor, value); } }
  69. //
  70. private double squigglyOpacity = 1;
  71. public double SquigglyOpacity
  72. { get { return squigglyOpacity; } set { SetProperty(ref squigglyOpacity, value); } }
  73. //
  74. private Brush strikeoutColor = new SolidColorBrush(Color.FromRgb(0xFF, 0xBB, 0x00));
  75. public Brush StrikeoutColor
  76. { get { return strikeoutColor; } set { SetProperty(ref strikeoutColor, value); } }
  77. //
  78. private double strikeoutOpacity = 1;
  79. public double StrikeoutOpacity
  80. { get { return strikeoutOpacity; } set { SetProperty(ref strikeoutOpacity, value); } }
  81. private bool btnSelecttoolIsChecked = false;
  82. public bool BtnSelecttoolIsChecked
  83. {
  84. get { return btnSelecttoolIsChecked; }
  85. set
  86. {
  87. SetProperty(ref btnSelecttoolIsChecked, value);
  88. }
  89. }
  90. private bool btnLinkIsChecked = false;
  91. public bool BtnLinkIsChecked
  92. {
  93. get { return btnLinkIsChecked; }
  94. set
  95. {
  96. SetProperty(ref btnLinkIsChecked, value);
  97. }
  98. }
  99. private bool btnHandIsChecked = false;
  100. public bool BtnHandIsChecked
  101. {
  102. get { return btnHandIsChecked; }
  103. set
  104. {
  105. SetProperty(ref btnHandIsChecked, value);
  106. }
  107. }
  108. #endregion 注释工具
  109. #endregion 属性
  110. public string PropertyRegionName { get; set; }
  111. private IEventAggregator events;
  112. public IDialogService dialogs;
  113. public IRegionManager region;
  114. private CPDFViewer PDFViewer;
  115. private ViewContentViewModel viewContentViewModel;
  116. private AnnotPropertyPanel propertyPanel = new AnnotPropertyPanel();
  117. private Dictionary<string, AnnotArgsType> ToolExpandDict = new Dictionary<string, AnnotArgsType>();
  118. private bool isHiddenAnnot = true;
  119. private bool isAddBookMark = true;
  120. private bool isRightMenuAddAnnot = false;
  121. #region 事件
  122. public DelegateCommand<CustomIconToggleBtn> MyToolsCommand { get; set; }
  123. private SnapshotEditMenuViewModel snapshotEditMenuViewModel = new SnapshotEditMenuViewModel();
  124. public SnapshotEditMenuViewModel SnapshotEditMenuViewModel { get => snapshotEditMenuViewModel; set => snapshotEditMenuViewModel = value; }
  125. public DelegateCommand<object> SetAddAnnotationCommand { get; set; }
  126. #endregion 事件
  127. }
  128. public enum AddAnnotType
  129. {
  130. AnnotFreehand,//绘制
  131. AnnotFreeText = 1,//文本
  132. AnnotSticky,//便签
  133. AnnotSquare,//矩形
  134. AnnotCircle,//椭圆形
  135. AnnotArrow,//箭头
  136. AnnotLine,//直线
  137. AnnotLink,//链接
  138. AnnotStamp,//图章
  139. AnnotAutograph //签名
  140. }
  141. }