using ComPDFKit.PDFDocument; using PDF_Office.Model; using Prism.Commands; using Prism.Mvvm; using Prism.Services.Dialogs; using System; using System.Collections.Generic; using System.Diagnostics; using System.Linq; namespace PDF_Office.ViewModels.Dialog.ToolsDialogs.SaftyDialogs { public class CancelPasswordDialogViewModel : BindableBase,IDialogAware { public IDialogService dialogs; private CPDFDocument document; public DelegateCommand CheckPasswordCommand { get; set; } public CancelPasswordDialogViewModel(IDialogService dialogService) { dialogs = dialogService; CheckPasswordCommand = new DelegateCommand(OpenCheckPassword); } private void OpenCheckPassword() { DialogParameters value = new DialogParameters(); value.Add("1", 1); RequestClose?.Invoke(new DialogResult(ButtonResult.OK)); dialogs.ShowDialog(DialogNames.CheckPasswordDialog, value, e => { }); } public string Title => ""; public event Action RequestClose; public bool CanCloseDialog() { return true; } public void OnDialogClosed() { } public void OnDialogOpened(IDialogParameters parameters) { CPDFDocument doc = null; parameters.TryGetValue(ParameterNames.PDFDocument, out doc); if (doc != null) { document = doc; } } } }