AnnotToolContentViewModel.Properties.cs 5.0 KB

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