AnnotToolContentViewModel.Properties.cs 5.6 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182
  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 AnnotHandlerEventArgs annot;
  24. public event EventHandler<Dictionary<AnnotArgsType, object>> DataChanged;
  25. public event EventHandler<Dictionary<AnnotArgsType, object>> AnnotTypeChanged;
  26. public event EventHandler<object> DefaultStored;
  27. public AnnotPropertyPanel()
  28. { }
  29. /// <summary>
  30. /// 触发到工具栏注释工具,改变工具图标下的颜色值
  31. /// </summary>
  32. /// <param name="sender"></param>
  33. /// <param name="keyValues"></param>
  34. public void DataChangedInvoke(object sender, Dictionary<AnnotArgsType, object> keyValues)
  35. {
  36. DataChanged?.Invoke(sender, keyValues);
  37. }
  38. public void AnnotTypeChangedInvoke(object sender, Dictionary<AnnotArgsType, object> keyValues)
  39. {
  40. AnnotTypeChanged?.Invoke(sender, keyValues);
  41. }
  42. }
  43. public sealed partial class AnnotToolContentViewModel
  44. {
  45. #region 属性
  46. #region 注释工具
  47. //高亮
  48. private Brush highLightColor = new SolidColorBrush(Color.FromRgb(0xFF, 0xBB, 0x00));
  49. public Brush HighLightColor
  50. { get { return highLightColor; } set { SetProperty(ref highLightColor, value); } }
  51. //
  52. private double highLightOpacity = 1;
  53. public double HighLightOpacity
  54. { get { return highLightOpacity; } set { SetProperty(ref highLightOpacity, value); } }
  55. //
  56. private Brush underLine = new SolidColorBrush(Color.FromRgb(0xFF, 0xBB, 0x00));
  57. public Brush UnderLineColor
  58. { get { return underLine; } set { SetProperty(ref underLine, value); } }
  59. //
  60. private double underLineOpacity = 1;
  61. public double UnderLineOpacity
  62. { get { return underLineOpacity; } set { SetProperty(ref underLineOpacity, value); } }
  63. //
  64. private Brush squigglyColor = new SolidColorBrush(Color.FromRgb(0xFF, 0xBB, 0x00));
  65. public Brush SquigglyColor
  66. { get { return squigglyColor; } set { SetProperty(ref squigglyColor, value); } }
  67. //
  68. private double squigglyOpacity = 1;
  69. public double SquigglyOpacity
  70. { get { return squigglyOpacity; } set { SetProperty(ref squigglyOpacity, value); } }
  71. //
  72. private Brush strikeoutColor = new SolidColorBrush(Color.FromRgb(0xFF, 0xBB, 0x00));
  73. public Brush StrikeoutColor
  74. { get { return strikeoutColor; } set { SetProperty(ref strikeoutColor, value); } }
  75. //
  76. private double strikeoutOpacity = 1;
  77. public double StrikeoutOpacity
  78. { get { return strikeoutOpacity; } set { SetProperty(ref strikeoutOpacity, value); } }
  79. private bool btnSelecttoolIsChecked = false;
  80. public bool BtnSelecttoolIsChecked
  81. {
  82. get { return btnSelecttoolIsChecked; }
  83. set
  84. {
  85. SetProperty(ref btnSelecttoolIsChecked, value);
  86. }
  87. }
  88. private bool btnLinkIsChecked = false;
  89. public bool BtnLinkIsChecked
  90. {
  91. get { return btnLinkIsChecked; }
  92. set
  93. {
  94. SetProperty(ref btnLinkIsChecked, value);
  95. }
  96. }
  97. private bool btnHandIsChecked = false;
  98. public bool BtnHandIsChecked
  99. {
  100. get { return btnHandIsChecked; }
  101. set
  102. {
  103. SetProperty(ref btnHandIsChecked, value);
  104. }
  105. }
  106. #endregion 注释工具
  107. #endregion 属性
  108. public string PropertyRegionName { get; set; }
  109. private IEventAggregator events;
  110. public IDialogService dialogs;
  111. public IRegionManager region;
  112. private CPDFViewer PDFViewer;
  113. private ViewContentViewModel viewContentViewModel;
  114. private AnnotPropertyPanel propertyPanel = new AnnotPropertyPanel();
  115. private Dictionary<string, AnnotArgsType> ToolExpandDict = new Dictionary<string, AnnotArgsType>();
  116. private bool isHiddenAnnot = true;
  117. private bool isAddBookMark = true;
  118. //private BookmarkContentViewModel bookmarkContentViewModel = null;
  119. //private BookmarkContent bookmark = null;
  120. //private BOTAContent bOTAContent = null;
  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. }