1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374757677787980818283 |
- using Prism.Mvvm;
- using System;
- using System.Collections.Generic;
- using System.Linq;
- using System.Text;
- using System.Threading.Tasks;
- using Prism.Services.Dialogs;
- using PDF_Master.Model.PageEdit;
- using Prism.Commands;
- using PDF_Master.Model;
- using ComPDFKitViewer.PdfViewer;
- namespace PDF_Master.ViewModels.Dialog.PageEditDialogs
- {
- public class ExtractDialogViewModel : BindableBase, IDialogAware
- {
- private bool isDeleteAfterExtract = true;
- public string Title => "";
- public event Action<IDialogResult> RequestClose;
- public DelegateCommand CancelCommand { get; set; }
- public DelegateCommand ExtractCommnad { get; set; }
- private ExtractModel model;
- public ExtractModel Model
- {
- get { return model; }
- set
- {
- SetProperty(ref model, value);
- }
- }
- private bool isEnabledDeleteAfterExtract = true;
- public bool IsEnabledDeleteAfterExtract
- {
- get { return isEnabledDeleteAfterExtract; }
- set
- {
- SetProperty(ref isEnabledDeleteAfterExtract, value);
- }
- }
- public ExtractDialogViewModel()
- {
- Model = new ExtractModel();
- CancelCommand = new DelegateCommand(cancel);
- ExtractCommnad = new DelegateCommand(extract);
- }
- private void cancel()
- {
- RequestClose.Invoke(new DialogResult(ButtonResult.Cancel));
- }
- private void extract()
- {
- DialogParameters valuePairs = new DialogParameters();
- valuePairs.Add(ParameterNames.DataModel, Model);
- RequestClose.Invoke(new DialogResult(ButtonResult.OK, valuePairs));
- }
- public bool CanCloseDialog()
- {
- return true;
- }
- public void OnDialogClosed()
- {
- return;
- }
- public void OnDialogOpened(IDialogParameters parameters)
- {
- parameters.TryGetValue<bool>(ParameterNames.IsDeleteAfterExtract, out isDeleteAfterExtract);
- IsEnabledDeleteAfterExtract = isDeleteAfterExtract ? true : false;
- }
- }
- }
|