AnnotCommon.cs 5.6 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189
  1. using ComPDFKitViewer.AnnotEvent;
  2. using PDF_Office.CustomControl.CompositeControl;
  3. using PDF_Office.Helper;
  4. using PDF_Office.Properties;
  5. using PDFSettings;
  6. using Prism.Mvvm;
  7. using System;
  8. using System.Collections.Generic;
  9. using System.Linq;
  10. using System.Text;
  11. using System.Threading.Tasks;
  12. using System.Windows.Media;
  13. namespace PDF_Office.Model.AnnotPanel
  14. {
  15. //注释的通用属性
  16. public class AnnotCommon : BindableBase
  17. {
  18. //注释类型
  19. private AnnotArgsType _annotType;
  20. public AnnotArgsType AnnotType
  21. {
  22. get { return _annotType; }
  23. set => SetProperty(ref _annotType, value);
  24. }
  25. //注释类型名称
  26. private string _annotTypeTitle;
  27. public string AnnotTypeTitle
  28. {
  29. get { return _annotTypeTitle; }
  30. set => SetProperty(ref _annotTypeTitle, value);
  31. }
  32. #region 线条
  33. //线条粗细大小
  34. private double _annotThickness = 1;
  35. public double AnnotThickness
  36. {
  37. get { return _annotThickness; }
  38. set => SetProperty(ref _annotThickness, value);
  39. }
  40. //线条样式
  41. private DashStyle dash = new DashStyle();
  42. public DashStyle Dash
  43. {
  44. get { return dash; }
  45. set => SetProperty(ref dash, value);
  46. }
  47. #endregion 线条
  48. #region 填充
  49. //填充颜色透明度
  50. private double fillOpacity = 1;
  51. public double FillOpacity
  52. {
  53. get { return fillOpacity; }
  54. set => SetProperty(ref fillOpacity, value);
  55. }
  56. //当前填充颜色
  57. private Brush _currentFillColor = new SolidColorBrush(Colors.Transparent);
  58. public Brush CurrentFillColor
  59. {
  60. get { return _currentFillColor; }
  61. set => SetProperty(ref _currentFillColor, value);
  62. }
  63. //填充颜色
  64. private Brush fillColor = new SolidColorBrush(Colors.Transparent);
  65. public Brush FillColor
  66. {
  67. get { return fillColor; }
  68. set { SetProperty(ref fillColor, value); CurrentFillColor = fillColor; }
  69. }
  70. //边框颜色集合
  71. private List<ColorItem> _colorItems = new List<ColorItem>();
  72. public List<ColorItem> ColorItems
  73. {
  74. get { return _colorItems; }
  75. set => SetProperty(ref _colorItems, value);
  76. }
  77. //填充颜色集合
  78. private List<ColorItem> _fillColorItems = new List<ColorItem>();
  79. public List<ColorItem> FillColorItems
  80. {
  81. get { return _fillColorItems; }
  82. set => SetProperty(ref _fillColorItems, value);
  83. }
  84. #endregion 填充
  85. #region 边框
  86. //边框颜色透明度
  87. private double _borderOpacity = 1;
  88. public double BorderOpacity
  89. {
  90. get { return _borderOpacity; }
  91. set => SetProperty(ref _borderOpacity, value);
  92. }
  93. private Brush _borderColor = new SolidColorBrush(Colors.Transparent);
  94. public Brush BorderColor
  95. {
  96. get { return _borderColor; }
  97. set { SetProperty(ref _borderColor, value); CurrentBorderColor = _borderColor; }
  98. }
  99. //当前边框颜色
  100. private Brush _currentBorderColor = new SolidColorBrush(Colors.Transparent);
  101. public Brush CurrentBorderColor
  102. {
  103. get { return _currentBorderColor; }
  104. set => SetProperty(ref _currentBorderColor, value);
  105. }
  106. private Brush _fontColor = new SolidColorBrush(Colors.Transparent);
  107. public Brush FontColor
  108. {
  109. get { return _fontColor; }
  110. set { SetProperty(ref _fontColor, value); CurrentFontColor = _fontColor; }
  111. }
  112. //当前边框颜色
  113. private Brush _currentFontColor = new SolidColorBrush(Colors.Transparent);
  114. public Brush CurrentFontColor
  115. {
  116. get { return _currentFontColor; }
  117. set => SetProperty(ref _currentFontColor, value);
  118. }
  119. //是否为实线
  120. private bool _isSolidLine = true;
  121. public bool IsSolidLine
  122. {
  123. get { return _isSolidLine; }
  124. set => SetProperty(ref _isSolidLine, value);
  125. }
  126. //是否为虚线
  127. private bool _isDashLine = true;
  128. public bool IsDashLine
  129. {
  130. get { return _isDashLine; }
  131. set => SetProperty(ref _isDashLine, value);
  132. }
  133. //外部UI引用,其他:例如形状注释类型
  134. public string strOtherTag { get; private set; }
  135. //VM赋值
  136. public void SetOtherTag(string str)
  137. {
  138. strOtherTag = str;
  139. }
  140. #endregion
  141. #region 多选
  142. //多选注释:用处 - 多选注释使得下拉框为空内容,刷新最新的UI布局
  143. private bool _isMultiSelected = false;
  144. public bool IsMultiSelected
  145. {
  146. get { return _isMultiSelected; }
  147. set => SetProperty(ref _isMultiSelected, value);
  148. }
  149. #endregion
  150. /// <summary>
  151. /// VM触发到外部UI事件
  152. /// </summary>
  153. public event EventHandler<object> SelectedAnnotInvokeToUI;
  154. //Todo:由于考虑到有些UI在VM不太方便处理,因此需要触发该函数到外部xaml.cs里更改UI属性。
  155. //更改多个属性:value可为键值对集合
  156. //适应范围:若VM在Loaded进行绑定,需要UI初始化之后,才能起到作用
  157. public void InvokeToUI(object sender, object value)
  158. {
  159. SelectedAnnotInvokeToUI?.Invoke(sender, value);
  160. }
  161. }
  162. }