FormBaseVM.cs 6.2 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209
  1. using Prism.Mvvm;
  2. using System;
  3. using System.Collections.Generic;
  4. using System.Linq;
  5. using System.Text;
  6. using System.Threading.Tasks;
  7. using System.Windows.Media;
  8. namespace PDF_Office.ViewModels.Form
  9. {
  10. public enum FormAttributeType
  11. {
  12. Name,
  13. ToolTip,
  14. IsReadOnly,
  15. IsRequiredField,
  16. IsLocked,
  17. //外观
  18. BorderThiness,
  19. IsSolid,
  20. WidthSize,
  21. HeightSize,
  22. BorderColor,
  23. ContentColor,
  24. FillColor,
  25. FontFamily
  26. }
  27. public class ResetColor : BindableBase
  28. {
  29. private SolidColorBrush _borderColor;
  30. public SolidColorBrush BorderColor
  31. {
  32. get { return _borderColor; }
  33. set { SetProperty(ref _borderColor, value); }
  34. }
  35. private SolidColorBrush _fontColor;
  36. public SolidColorBrush FontColor
  37. {
  38. get { return _fontColor; }
  39. set { SetProperty(ref _fontColor, value); }
  40. }
  41. private SolidColorBrush _fillColor;
  42. public SolidColorBrush FillColor
  43. {
  44. get { return _fillColor; }
  45. set { SetProperty(ref _fillColor, value); }
  46. }
  47. }
  48. public class FormBaseVM : BindableBase
  49. {
  50. #region 触发事件
  51. public event EventHandler<FormAttributeType> ChangeValueHandler;
  52. #endregion
  53. #region 一般
  54. //提示
  55. private string _toolTipStr;
  56. public string ToolTipStr
  57. {
  58. get { return _toolTipStr; }
  59. set { SetProperty(ref _toolTipStr, value); ChangeValueHandler?.Invoke(value, FormAttributeType.ToolTip); }
  60. }
  61. //名称
  62. private string _nameStr;
  63. public string NameStr
  64. {
  65. get { return _nameStr; }
  66. set { SetProperty(ref _nameStr, value); ChangeValueHandler?.Invoke(value, FormAttributeType.Name); }
  67. }
  68. //只读
  69. public bool _isReadOnly = false;
  70. public bool IsReadOnly
  71. {
  72. get { return _isReadOnly; }
  73. set { SetProperty(ref _isReadOnly, value); ChangeValueHandler?.Invoke(value, FormAttributeType.IsReadOnly); }
  74. }
  75. //必填
  76. public bool _isRequiredField = false;
  77. public bool IsRequiredField
  78. {
  79. get { return _isRequiredField; }
  80. set { SetProperty(ref _isRequiredField, value); ChangeValueHandler?.Invoke(value, FormAttributeType.IsRequiredField); }
  81. }
  82. //锁定
  83. public bool _isLocked = false;
  84. public bool IsLocked
  85. {
  86. get { return _isLocked; }
  87. set { SetProperty(ref _isLocked, value); ChangeValueHandler?.Invoke(value, FormAttributeType.IsLocked); }
  88. }
  89. #endregion
  90. #region 外观
  91. //边框大小
  92. private double _borderThiness = 0;
  93. public double BorderThiness
  94. {
  95. get { return _borderThiness; }
  96. set { SetProperty(ref _borderThiness, value); ChangeValueHandler?.Invoke(value, FormAttributeType.BorderThiness); }
  97. }
  98. //是否为实线条
  99. private bool _isSolid = true;
  100. public bool IsSolid
  101. {
  102. get { return _isSolid; }
  103. set { SetProperty(ref _isSolid, value); }
  104. }
  105. //是否为实线条
  106. private ComPDFKit.PDFAnnotation.C_BORDER_STYLE _borderStyle = ComPDFKit.PDFAnnotation.C_BORDER_STYLE.BS_SOLID;
  107. public ComPDFKit.PDFAnnotation.C_BORDER_STYLE BorderStyle
  108. {
  109. get { return _borderStyle; }
  110. set {
  111. SetProperty(ref _borderStyle, value);
  112. if (value == ComPDFKit.PDFAnnotation.C_BORDER_STYLE.BS_SOLID)
  113. IsSolid = true;
  114. else
  115. IsSolid = false;
  116. ChangeValueHandler?.Invoke(value, FormAttributeType.IsSolid); }
  117. }
  118. //宽大小
  119. private double _widthSize = 150;
  120. public double WidthSize
  121. {
  122. get { return _widthSize; }
  123. set { SetProperty(ref _widthSize, value); ChangeValueHandler?.Invoke(value, FormAttributeType.WidthSize); }
  124. }
  125. //高大小
  126. private double _heightSize = 22;
  127. public double HeightSize
  128. {
  129. get { return _heightSize; }
  130. set { SetProperty(ref _heightSize, value); ChangeValueHandler?.Invoke(value, FormAttributeType.HeightSize); }
  131. }
  132. //边框颜色
  133. private Color _borderColor = Colors.Transparent;
  134. public Color BorderColor
  135. {
  136. get { return _borderColor; }
  137. set { SetProperty(ref _borderColor, value); ChangeValueHandler?.Invoke(value, FormAttributeType.BorderColor); }
  138. }
  139. //内容颜色
  140. private Color _contentColor = Colors.Transparent;
  141. public Color ContentColor
  142. {
  143. get { return _contentColor; }
  144. set { SetProperty(ref _contentColor, value); ChangeValueHandler?.Invoke(value, FormAttributeType.ContentColor); }
  145. }
  146. //填充颜色
  147. private Color _fillColor = Colors.Transparent;
  148. public Color FillColor
  149. {
  150. get { return _fillColor; }
  151. set { SetProperty(ref _fillColor, value); ChangeValueHandler?.Invoke(value, FormAttributeType.FillColor); }
  152. }
  153. #endregion
  154. #region 颜色样式
  155. private ResetColor _resetColorOne = new ResetColor();
  156. public ResetColor ResetColorOne
  157. {
  158. get { return _resetColorOne; }
  159. set { SetProperty(ref _resetColorOne, value); }
  160. }
  161. private ResetColor _resetColorTwo = new ResetColor();
  162. public ResetColor ResetColorTwo
  163. {
  164. get { return _resetColorTwo; }
  165. set { SetProperty(ref _resetColorTwo, value); }
  166. }
  167. private ResetColor _resetColorThree = new ResetColor();
  168. public ResetColor ResetColorThree
  169. {
  170. get { return _resetColorThree; }
  171. set { SetProperty(ref _resetColorThree, value); }
  172. }
  173. private ResetColor _resetColorForth = new ResetColor();
  174. public ResetColor ResetColorForth
  175. {
  176. get { return _resetColorForth; }
  177. set { SetProperty(ref _resetColorForth, value); }
  178. }
  179. #endregion
  180. }
  181. }