DynamicPropertyDialogViewModel.cs 2.7 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105
  1. using ComPDFKit.PDFAnnotation;
  2. using ComPDFKitViewer.PdfViewer;
  3. using PDF_Master.Model;
  4. using Prism.Commands;
  5. using Prism.Mvvm;
  6. using Prism.Services.Dialogs;
  7. using System;
  8. using System.Collections.Generic;
  9. using System.Collections.ObjectModel;
  10. using System.Linq;
  11. using System.Text;
  12. using System.Threading.Tasks;
  13. using System.Windows.Controls;
  14. using System.Windows.Input;
  15. using System.Windows.Media;
  16. using System.Windows.Media.Imaging;
  17. namespace PDF_Master.ViewModels.PropertyPanel.AnnotPanel
  18. {
  19. class DynamicPropertyDialogViewModel : BindableBase, IDialogAware
  20. {
  21. public string Title => ".";
  22. public event Action<IDialogResult> RequestClose;
  23. public DelegateCommand CancelCommand { get; set; }
  24. public DelegateCommand ApplyCommnad { get; set; }
  25. public ObservableCollection<string> DateFormatList { get; set; }
  26. private bool isChecked = true;
  27. public bool IsChecked
  28. {
  29. get { return isChecked; }
  30. set
  31. {
  32. SetProperty(ref isChecked, value);
  33. }
  34. }
  35. private string author = "Kdan";
  36. public string Author
  37. {
  38. get { return author; }
  39. set
  40. {
  41. SetProperty(ref author, value);
  42. }
  43. }
  44. private int selectedIndex = 0;
  45. public int SelectedIndex
  46. {
  47. get { return selectedIndex; }
  48. set
  49. {
  50. SetProperty(ref selectedIndex, value);
  51. }
  52. }
  53. public DynamicPropertyDialogViewModel()
  54. {
  55. CancelCommand = new DelegateCommand(Cancel);
  56. ApplyCommnad = new DelegateCommand(Apply);
  57. DateFormatList = new ObservableCollection<string>
  58. {
  59. "Defualt",
  60. "M/d", "M/d/yy", "M/d/yyyy", "MM/dd/yy","MM/dd/yyyy",
  61. "d/M/y","d/M/yyy","dd/MM/yy","dd/MM/yyy","MM/yy","MM/yyyy",
  62. "M.d.y","M.d.yyyy","MM.dd.yy","MM.dd.yyyy","MM/yy","MM/yyyy",
  63. "d.M.y","d.M.yyyy","dd.MM.yy","dd.MM.yyyy","yy-MM-dd","yyyy-MM-dd"
  64. };
  65. }
  66. private void Cancel()
  67. {
  68. RequestClose.Invoke(new DialogResult(ButtonResult.Cancel));
  69. }
  70. private void Apply()
  71. {
  72. DialogParameters valuePairs = new DialogParameters();
  73. valuePairs.Add(ParameterNames.DataModel, this);
  74. RequestClose.Invoke(new DialogResult(ButtonResult.OK, valuePairs));
  75. }
  76. public bool CanCloseDialog()
  77. {
  78. return true;
  79. }
  80. public void OnDialogClosed()
  81. {
  82. return;
  83. }
  84. public void OnDialogOpened(IDialogParameters parameters)
  85. {
  86. return;
  87. }
  88. }
  89. }