AnnotBasePropertyVM.cs 4.5 KB

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