ExtractDialogViewModel.cs 1.6 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970
  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 Prism.Services.Dialogs;
  8. using PDF_Master.Model.PageEdit;
  9. using Prism.Commands;
  10. using PDF_Master.Model;
  11. namespace PDF_Master.ViewModels.Dialog.PageEditDialogs
  12. {
  13. public class ExtractDialogViewModel:BindableBase,IDialogAware
  14. {
  15. public string Title => "";
  16. public event Action<IDialogResult> RequestClose;
  17. public DelegateCommand CancelCommand { get; set; }
  18. public DelegateCommand ExtractCommnad { get; set; }
  19. private ExtractModel model;
  20. public ExtractModel Model
  21. {
  22. get { return model; }
  23. set
  24. {
  25. SetProperty(ref model, value);
  26. }
  27. }
  28. public ExtractDialogViewModel()
  29. {
  30. Model = new ExtractModel();
  31. CancelCommand = new DelegateCommand(cancel);
  32. ExtractCommnad = new DelegateCommand(extract);
  33. }
  34. private void cancel()
  35. {
  36. RequestClose.Invoke(new DialogResult(ButtonResult.Cancel));
  37. }
  38. private void extract()
  39. {
  40. DialogParameters valuePairs = new DialogParameters();
  41. valuePairs.Add(ParameterNames.DataModel,Model);
  42. RequestClose.Invoke(new DialogResult(ButtonResult.OK,valuePairs));
  43. }
  44. public bool CanCloseDialog()
  45. {
  46. return true;
  47. }
  48. public void OnDialogClosed()
  49. {
  50. return;
  51. }
  52. public void OnDialogOpened(IDialogParameters parameters)
  53. {
  54. }
  55. }
  56. }