ComboxPropertyViewModel.cs 4.1 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168
  1. using ComPDFKitViewer.AnnotEvent;
  2. using ComPDFKitViewer.PdfViewer;
  3. using PDF_Office.Model;
  4. using Prism.Mvvm;
  5. using Prism.Regions;
  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.Form
  13. {
  14. public class ComboxPropertyViewModel : FormBaseVM, INavigationAware
  15. {
  16. #region 属性
  17. #region 选项
  18. //排序项目
  19. private bool _isSortProject = false;
  20. public bool IsSortProject
  21. {
  22. get { return _isSortProject; }
  23. set { SetProperty(ref _isSortProject, value); }
  24. }
  25. //允许用户输入自定义文本
  26. private bool _isAllowInOutText = false;
  27. public bool IsAllowInOutText
  28. {
  29. get { return _isAllowInOutText; }
  30. set { SetProperty(ref _isAllowInOutText, value); }
  31. }
  32. #endregion
  33. #endregion
  34. #region Command
  35. #endregion
  36. #region 变量
  37. private CPDFViewer PDFViewer;
  38. private WidgetComboBoxArgs comboBoxArgs;
  39. #endregion
  40. #region 初始化
  41. public ComboxPropertyViewModel()
  42. {
  43. InitVariable();
  44. InitCommand();
  45. }
  46. private void InitVariable()
  47. {
  48. }
  49. private void InitCommand()
  50. {
  51. //ChangeValueHandler -= ChangeValue;
  52. //ChangeValueHandler += ChangeValue;
  53. }
  54. #endregion
  55. #region 一般处理
  56. #endregion
  57. #region 外观处理
  58. #endregion
  59. #region 选项处理
  60. #endregion
  61. #region Navegation
  62. public bool IsNavigationTarget(NavigationContext navigationContext)
  63. {
  64. return true;
  65. }
  66. public void OnNavigatedFrom(NavigationContext navigationContext)
  67. {
  68. comboBoxArgs = null;
  69. }
  70. public void OnNavigatedTo(NavigationContext navigationContext)
  71. {
  72. navigationContext.Parameters.TryGetValue<CPDFViewer>(ParameterNames.PDFViewer, out PDFViewer);
  73. navigationContext.Parameters.TryGetValue<WidgetComboBoxArgs>("WidgetArgs", out comboBoxArgs);
  74. GetWidgeText();
  75. }
  76. private void GetWidgeText()
  77. {
  78. PDFViewer.SetMouseMode(MouseModes.FormEditTool);
  79. if (comboBoxArgs == null)
  80. {
  81. comboBoxArgs = new WidgetComboBoxArgs();
  82. comboBoxArgs.BgColor = Colors.White;
  83. comboBoxArgs.FontFamily = "Courier New";
  84. comboBoxArgs.FontSize = 12;
  85. comboBoxArgs.FontColor = Colors.Black;
  86. comboBoxArgs.LineColor = Colors.Black;
  87. comboBoxArgs.LineWidth = 1;
  88. comboBoxArgs.FieldName = "ComBox";
  89. PDFViewer.SetToolParam(comboBoxArgs);
  90. }
  91. else
  92. {
  93. PDFViewer.SetToolParam(new AnnotHandlerEventArgs());
  94. }
  95. }
  96. //更改基类公共属性后,触发的事件
  97. //private void ChangeValue(object sender, FormAttributeType e)
  98. //{
  99. // switch (e)
  100. // {
  101. // case FormAttributeType.Name:
  102. // break;
  103. // case FormAttributeType.ToolTip:
  104. // break;
  105. // case FormAttributeType.IsSolid:
  106. // break;
  107. // case FormAttributeType.IsLocked:
  108. // break;
  109. // case FormAttributeType.HeightSize:
  110. // break;
  111. // case FormAttributeType.BorderThiness:
  112. // break;
  113. // case FormAttributeType.BorderColor:
  114. // break;
  115. // case FormAttributeType.ContentColor:
  116. // break;
  117. // case FormAttributeType.IsReadOnly:
  118. // break;
  119. // case FormAttributeType.WidthSize:
  120. // break;
  121. // case FormAttributeType.IsRequiredField:
  122. // break;
  123. // }
  124. //}
  125. #endregion
  126. }
  127. }