PageEditControl.xaml.cs 2.0 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162
  1. using System;
  2. using System.Windows;
  3. using System.Windows.Controls;
  4. namespace ComPDFKit.Controls.PDFControl
  5. {
  6. public partial class PageEditControl : UserControl
  7. {
  8. #region Properties
  9. private PDFViewControl _pdfViewControl;
  10. public PDFViewControl PDFViewControl
  11. {
  12. get => _pdfViewControl;
  13. set
  14. {
  15. _pdfViewControl = value;
  16. pageEditControl.viewControl = _pdfViewControl;
  17. pageEditControl.LoadThumbnails(_pdfViewControl);
  18. pageEditControl.isThumbInitialized = false;
  19. }
  20. }
  21. //When the order or total number of pages changes
  22. public event RoutedEventHandler PageMoved;
  23. public event EventHandler ExitPageEdit;
  24. public event EventHandler<bool> OnCanSaveChanged;
  25. public event EventHandler OnAnnotEditHandler;
  26. #endregion
  27. public PageEditControl()
  28. {
  29. InitializeComponent();
  30. this.DataContext = this;
  31. pageEditControl.PageMoved -= PageEditControl_PageMoved;
  32. pageEditControl.PageMoved += PageEditControl_PageMoved;
  33. CPDFPageEditBarControl.PageEditEvent -= CPDFPageEditBarControl_PageEditEvent;
  34. CPDFPageEditBarControl.PageEditEvent += CPDFPageEditBarControl_PageEditEvent;
  35. pageEditControl.ExitPageEdit -= PageEditControl_ExitPageEdit;
  36. pageEditControl.ExitPageEdit += PageEditControl_ExitPageEdit;
  37. }
  38. #region Private Command Methods
  39. private void PageEditControl_ExitPageEdit(object sender, EventArgs e)
  40. {
  41. this.ExitPageEdit?.Invoke(this, EventArgs.Empty);
  42. }
  43. private void CPDFPageEditBarControl_PageEditEvent(object sender, string e)
  44. {
  45. pageEditControl.PageEdit(e);
  46. }
  47. private void PageEditControl_PageMoved(object sender, RoutedEventArgs e)
  48. {
  49. PageMoved?.Invoke(this, e);
  50. }
  51. #endregion
  52. }
  53. }