CheckBoxPropertyViewModel.cs 2.4 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117
  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 CheckBoxPropertyViewModel : FormBaseVM, INavigationAware
  15. {
  16. #region 属性
  17. #region 选项
  18. //导出值
  19. private string _exportValue;
  20. public string ExportValue
  21. {
  22. get { return _exportValue; }
  23. set { SetProperty(ref _exportValue, value); }
  24. }
  25. //复选框默认为选中
  26. private bool _isDefaultChecked = false;
  27. public bool IsDefaultChecked
  28. {
  29. get { return _isDefaultChecked; }
  30. set { SetProperty(ref _isDefaultChecked, value); }
  31. }
  32. #endregion
  33. #endregion
  34. #region Command
  35. #endregion
  36. #region 变量
  37. private CPDFViewer PDFViewer;
  38. private WidgetCheckBoxArgs checkBoxArgs;
  39. #endregion
  40. #region 初始化
  41. public CheckBoxPropertyViewModel()
  42. {
  43. InitVariable();
  44. InitCommand();
  45. }
  46. private void InitVariable()
  47. {
  48. }
  49. private void InitCommand()
  50. {
  51. }
  52. #endregion
  53. #region 一般处理
  54. #endregion
  55. #region 外观处理
  56. #endregion
  57. #region 选项处理
  58. #endregion
  59. #region Navegation
  60. public bool IsNavigationTarget(NavigationContext navigationContext)
  61. {
  62. return true;
  63. }
  64. public void OnNavigatedFrom(NavigationContext navigationContext)
  65. {
  66. checkBoxArgs = null;
  67. }
  68. public void OnNavigatedTo(NavigationContext navigationContext)
  69. {
  70. navigationContext.Parameters.TryGetValue<CPDFViewer>(ParameterNames.PDFViewer, out PDFViewer);
  71. navigationContext.Parameters.TryGetValue<WidgetCheckBoxArgs>("WidgetArgs", out checkBoxArgs);
  72. GetWidgeText();
  73. }
  74. private void GetWidgeText()
  75. {
  76. if (checkBoxArgs == null)
  77. {
  78. checkBoxArgs = new WidgetCheckBoxArgs();
  79. }
  80. PDFViewer.SetMouseMode(MouseModes.FormEditTool);
  81. PDFViewer.SetToolParam(checkBoxArgs);
  82. }
  83. #endregion
  84. }
  85. }