123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081 |
- using PDF_Office.Model;
- using Prism.Commands;
- using Prism.Mvvm;
- using Prism.Services.Dialogs;
- using System;
- using System.Collections.Generic;
- using System.Linq;
- using System.Text;
- using System.Threading.Tasks;
- namespace PDF_Office.ViewModels.Dialog.BOTA
- {
- public class AddBookmarkDialogViewModel : BindableBase, IDialogAware
- {
- //public string Title => "";
- private string title;
- public string Title
- {
- get { return title; }
- set { SetProperty(ref title, value); }
- }
- public event Action<IDialogResult> RequestClose;
- private string bookmark;
- public string Bookmark
- {
- get { return bookmark; }
- set
- {
- SetProperty(ref bookmark, value);
- }
- }
- public DelegateCommand CancelCommand { get; set; }
- public DelegateCommand CreateCommnad { get; set; }
- public AddBookmarkDialogViewModel()
- {
- CancelCommand = new DelegateCommand(CancelEvent);
- CreateCommnad = new DelegateCommand(CreateEvent);
- }
- private void CreateEvent()
- {
- DialogParameters valuePairs = new DialogParameters();
- valuePairs.Add(ParameterNames.Bookmark, Bookmark);
- RequestClose.Invoke(new DialogResult(ButtonResult.OK, valuePairs));
- }
- private void CancelEvent()
- {
- RequestClose.Invoke(new DialogResult(ButtonResult.Cancel));
- }
- public bool CanCloseDialog()
- {
- return true;
- }
- public void OnDialogClosed()
- {
- return;
- }
- public void OnDialogOpened(IDialogParameters parameters)
- {
- string mark;
- parameters.TryGetValue<string>(ParameterNames.Bookmark, out mark);
- Bookmark = mark;
- string title;
- parameters.TryGetValue<string>(ParameterNames.Title, out title);
- Title = title;
- return;
- }
- }
- }
|