1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374 |
- using ComPDFKit.PDFDocument;
- using PDF_Office.Model;
- using PDF_Office.Model.Dialog.ToolsDialogs.SaftyDialogs;
- using Prism.Commands;
- using Prism.Mvvm;
- using Prism.Services.Dialogs;
- using System;
- using System.Collections.Generic;
- using System.Linq;
- using System.Xml.Linq;
- namespace PDF_Office.ViewModels.Dialog.ToolsDialogs.SaftyDialogs
- {
- public class CheckPasswordDialogViewModel : BindableBase,IDialogAware
- {
- #region 参数和属性
- private CPDFDocument document;
- #endregion
- #region 委托声明
- public DelegateCommand DelegateConfirmCheckPasswordCommand { get; set; }
- public DelegateCommand DelegateCancelCheckPasswordCommand { get; set; }
- #endregion
- public CheckPasswordDialogViewModel()
- {
- CheckPasswordDialogModel.Password = "";
- DelegateConfirmCheckPasswordCommand = new DelegateCommand(ConfirmCheckPassword);
- DelegateCancelCheckPasswordCommand = new DelegateCommand(CancelCheckPassword);
- }
- #region 逻辑函数
- private void ConfirmCheckPassword()
- {
- if (false)//TODO: 用于检测输入密码的权限,以及是否输入了正确的密码
- { }
- var dialogResult = new DialogResult(ButtonResult.OK);
- dialogResult.Parameters.Add("CheckPassword", true);
- RequestClose.Invoke(dialogResult);
- }
- private void CancelCheckPassword()
- {
- var dialogResult = new DialogResult(ButtonResult.Cancel);
- dialogResult.Parameters.Add("CheckPassword", false);
- RequestClose.Invoke(dialogResult);
- }
- #endregion
- #region 框架相关
- public string Title =>"";
- public event Action<IDialogResult> RequestClose;
- public bool CanCloseDialog()
- {
- return true;
- }
- public void OnDialogClosed()
- {
- }
- public void OnDialogOpened(IDialogParameters parameters)
- {
- CPDFDocument doc = null;
- parameters.TryGetValue<CPDFDocument>(ParameterNames.PDFDocument, out doc);
- if (doc != null)
- {
- document = doc;
- }
- }
- #endregion
- }
- }
|