RadioButtonPropertyViewModel.cs 2.4 KB

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