CancelPasswordDialogViewModel.cs 1.6 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162
  1. using ComPDFKit.PDFDocument;
  2. using PDF_Office.Model;
  3. using Prism.Commands;
  4. using Prism.Mvvm;
  5. using Prism.Services.Dialogs;
  6. using System;
  7. using System.Collections.Generic;
  8. using System.Diagnostics;
  9. using System.Linq;
  10. namespace PDF_Office.ViewModels.Dialog.ToolsDialogs.SaftyDialogs
  11. {
  12. public class CancelPasswordDialogViewModel : BindableBase,IDialogAware
  13. {
  14. public IDialogService dialogs;
  15. private CPDFDocument document;
  16. public DelegateCommand CheckPasswordCommand { get; set; }
  17. public CancelPasswordDialogViewModel(IDialogService dialogService)
  18. {
  19. dialogs = dialogService;
  20. CheckPasswordCommand = new DelegateCommand(OpenCheckPassword);
  21. }
  22. private void OpenCheckPassword()
  23. {
  24. DialogParameters value = new DialogParameters();
  25. value.Add("1", 1);
  26. RequestClose?.Invoke(new DialogResult(ButtonResult.OK));
  27. dialogs.ShowDialog(DialogNames.CheckPasswordDialog, value, e => {
  28. });
  29. }
  30. public string Title => "";
  31. public event Action<IDialogResult> RequestClose;
  32. public bool CanCloseDialog()
  33. {
  34. return true;
  35. }
  36. public void OnDialogClosed()
  37. {
  38. }
  39. public void OnDialogOpened(IDialogParameters parameters)
  40. {
  41. CPDFDocument doc = null;
  42. parameters.TryGetValue<CPDFDocument>(ParameterNames.PDFDocument, out doc);
  43. if (doc != null)
  44. {
  45. document = doc;
  46. }
  47. }
  48. }
  49. }