InsertDialogViewModel.cs 1.3 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455
  1. using Prism.Commands;
  2. using Prism.Mvvm;
  3. using Prism.Services.Dialogs;
  4. using System;
  5. using System.Collections.Generic;
  6. using System.Linq;
  7. using System.Text;
  8. using System.Threading.Tasks;
  9. namespace PDF_Office.ViewModels.Dialog.PageEditDialogs
  10. {
  11. public class InsertDialogViewModel : BindableBase, IDialogAware
  12. {
  13. public string Title =>"";
  14. public event Action<IDialogResult> RequestClose;
  15. public DelegateCommand CancelCommand { get; set; }
  16. public DelegateCommand InsertCommnad { get; set; }
  17. public InsertDialogViewModel()
  18. {
  19. CancelCommand = new DelegateCommand(cancel);
  20. InsertCommnad = new DelegateCommand(insert);
  21. }
  22. private void cancel()
  23. {
  24. RequestClose.Invoke(new DialogResult(ButtonResult.Cancel));
  25. }
  26. private void insert()
  27. {
  28. DialogParameters valuePairs = new DialogParameters();
  29. //valuePairs.Add(ParameterNames.DataModel, Model);
  30. RequestClose.Invoke(new DialogResult(ButtonResult.OK, valuePairs));
  31. }
  32. public bool CanCloseDialog()
  33. {
  34. return true;
  35. }
  36. public void OnDialogClosed()
  37. {
  38. }
  39. public void OnDialogOpened(IDialogParameters parameters)
  40. {
  41. }
  42. }
  43. }