BookmarkInfoDialogViewModel.cs 1.7 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172
  1. using Microsoft.Office.Interop.Word;
  2. using PDF_Master.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.Linq;
  9. using System.Text;
  10. using System.Threading.Tasks;
  11. namespace PDF_Master.ViewModels.Dialog.BOTA
  12. {
  13. internal class BookmarkInfoDialogViewModel : BindableBase, IDialogAware
  14. {
  15. private string bookmarkInfo;
  16. public string BookmarkInfo
  17. {
  18. get { return bookmarkInfo; }
  19. set
  20. {
  21. SetProperty(ref bookmarkInfo, value);
  22. }
  23. }
  24. public DelegateCommand CancelCommand { get; set; }
  25. public DelegateCommand OkCommnad { get; set; }
  26. public string Title => "";
  27. public event Action<IDialogResult> RequestClose;
  28. public BookmarkInfoDialogViewModel()
  29. {
  30. CancelCommand = new DelegateCommand(CancelEvent);
  31. OkCommnad = new DelegateCommand(OkEvent);
  32. }
  33. private void CancelEvent()
  34. {
  35. RequestClose.Invoke(new DialogResult(ButtonResult.Cancel));
  36. }
  37. private void OkEvent()
  38. {
  39. RequestClose.Invoke(new DialogResult(ButtonResult.OK));
  40. }
  41. public bool CanCloseDialog()
  42. {
  43. return true;
  44. }
  45. public void OnDialogClosed()
  46. {
  47. }
  48. public void OnDialogOpened(IDialogParameters parameters)
  49. {
  50. string mark;
  51. parameters.TryGetValue<string>(ParameterNames.BookmarkInfo, out mark);
  52. BookmarkInfo = mark;
  53. //string title;
  54. //parameters.TryGetValue<string>(ParameterNames.Title, out title);
  55. //Title = title;
  56. return;
  57. }
  58. }
  59. }