StickyNotePopupViewModel.cs 2.0 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273747576777879
  1. using ComPDFKitViewer.PdfViewer;
  2. using PDF_Office.Model;
  3. using PDF_Office.Properties;
  4. using Prism.Commands;
  5. using Prism.Mvvm;
  6. using Prism.Regions;
  7. using System;
  8. using System.Collections.Generic;
  9. using System.Linq;
  10. using System.Text;
  11. using System.Threading.Tasks;
  12. namespace PDF_Office.ViewModels.PropertyPanel.AnnotPanel
  13. {
  14. internal class StickyNotePopupViewModel : BindableBase, INavigationAware
  15. {
  16. private string authorText;
  17. public string AuthorText
  18. {
  19. get { return authorText; }
  20. set
  21. {
  22. SetProperty(ref authorText, value);
  23. }
  24. }
  25. private string dateText;
  26. public string DateText
  27. {
  28. get { return dateText; }
  29. set
  30. {
  31. SetProperty(ref dateText, value);
  32. }
  33. }
  34. private string contentText;
  35. public string ContentText
  36. {
  37. get { return contentText; }
  38. set
  39. {
  40. SetProperty(ref contentText, value);
  41. }
  42. }
  43. private ViewContentViewModel ViewContentViewModel;
  44. public DelegateCommand ContentTextLostFocus { get; set; }
  45. public StickyNotePopupViewModel()
  46. {
  47. ContentTextLostFocus = new DelegateCommand(ContentText_LostFocus);
  48. }
  49. private void ContentText_LostFocus()
  50. {
  51. ViewContentViewModel.IsNoteAdd = false;
  52. }
  53. public bool IsNavigationTarget(NavigationContext navigationContext)
  54. {
  55. return true;
  56. }
  57. public void OnNavigatedFrom(NavigationContext navigationContext)
  58. {
  59. }
  60. public void OnNavigatedTo(NavigationContext navigationContext)
  61. {
  62. navigationContext.Parameters.TryGetValue<ViewContentViewModel>(ParameterNames.ViewContentViewModel, out ViewContentViewModel);
  63. AuthorText = Settings.Default.AppProperties.Description.Author;
  64. DateText = DateTime.Now.ToString(@"yyyyMMddHHmmsszzz\'").Replace(':', '\'') + "\n";
  65. }
  66. }
  67. }