FormBaseVM.cs 3.8 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127
  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. }
  25. public class FormBaseVM : BindableBase
  26. {
  27. #region 触发事件
  28. public event EventHandler<FormAttributeType> ChangeValueHandler;
  29. #endregion
  30. #region 一般
  31. //提示
  32. private string _toolTipStr;
  33. public string ToolTipStr
  34. {
  35. get { return _toolTipStr; }
  36. set { SetProperty(ref _toolTipStr, value); ChangeValueHandler?.Invoke(value, FormAttributeType.ToolTip); }
  37. }
  38. //名称
  39. private string _nameStr;
  40. public string NameStr
  41. {
  42. get { return _nameStr; }
  43. set { SetProperty(ref _nameStr, value); ChangeValueHandler?.Invoke(value, FormAttributeType.Name); }
  44. }
  45. //只读
  46. public bool _isReadOnly = false;
  47. public bool IsReadOnly
  48. {
  49. get { return _isReadOnly; }
  50. set { SetProperty(ref _isReadOnly, value); ChangeValueHandler?.Invoke(value, FormAttributeType.IsReadOnly); }
  51. }
  52. //必填
  53. public bool _isRequiredField = false;
  54. public bool IsRequiredField
  55. {
  56. get { return _isRequiredField; }
  57. set { SetProperty(ref _isRequiredField, value); ChangeValueHandler?.Invoke(value, FormAttributeType.IsRequiredField); }
  58. }
  59. //锁定
  60. public bool _isLocked = false;
  61. public bool IsLocked
  62. {
  63. get { return _isLocked; }
  64. set { SetProperty(ref _isLocked, value); ChangeValueHandler?.Invoke(value, FormAttributeType.IsLocked); }
  65. }
  66. #endregion
  67. #region 外观
  68. //边框大小
  69. private double _borderThiness = 0;
  70. public double BorderThiness
  71. {
  72. get { return _borderThiness; }
  73. set { SetProperty(ref _borderThiness, value); ChangeValueHandler?.Invoke(value, FormAttributeType.BorderThiness); }
  74. }
  75. //是否为实线条
  76. private ComPDFKit.PDFAnnotation.C_BORDER_STYLE _isSolid = ComPDFKit.PDFAnnotation.C_BORDER_STYLE.BS_SOLID;
  77. public ComPDFKit.PDFAnnotation.C_BORDER_STYLE IsSolid
  78. {
  79. get { return _isSolid; }
  80. set { SetProperty(ref _isSolid, value); ChangeValueHandler?.Invoke(value, FormAttributeType.IsSolid); }
  81. }
  82. //宽大小
  83. private double _widthSize = 150;
  84. public double WidthSize
  85. {
  86. get { return _widthSize; }
  87. set { SetProperty(ref _widthSize, value); ChangeValueHandler?.Invoke(value, FormAttributeType.WidthSize); }
  88. }
  89. //高大小
  90. private double _heightSize = 22;
  91. public double HeightSize
  92. {
  93. get { return _heightSize; }
  94. set { SetProperty(ref _heightSize, value); ChangeValueHandler?.Invoke(value, FormAttributeType.HeightSize); }
  95. }
  96. //边框颜色
  97. private Color _borderColor = Colors.Transparent;
  98. public Color BorderColor
  99. {
  100. get { return _borderColor; }
  101. set { SetProperty(ref _borderColor, value); ChangeValueHandler?.Invoke(value, FormAttributeType.BorderColor); }
  102. }
  103. //内容颜色
  104. private Color _contentColor = Colors.Transparent;
  105. public Color ContentColor
  106. {
  107. get { return _contentColor; }
  108. set { SetProperty(ref _contentColor, value); ChangeValueHandler?.Invoke(value, FormAttributeType.ContentColor); }
  109. }
  110. #endregion
  111. }
  112. }