PageEditControl.xaml.cs 2.4 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475
  1. using ComPDFKitViewer.PdfViewer;
  2. using System;
  3. using System.Collections.Generic;
  4. using System.Linq;
  5. using System.Text;
  6. using System.Threading.Tasks;
  7. using System.Windows;
  8. using System.Windows.Controls;
  9. using System.Windows.Data;
  10. using System.Windows.Documents;
  11. using System.Windows.Input;
  12. using System.Windows.Media;
  13. using System.Windows.Media.Imaging;
  14. using System.Windows.Navigation;
  15. using System.Windows.Shapes;
  16. namespace Compdfkit_Tools.PDFControl
  17. {
  18. public partial class PageEditControl : UserControl
  19. {
  20. #region Properties
  21. private PDFViewControl _pdfViewControl;
  22. public PDFViewControl PDFViewControl
  23. {
  24. get => _pdfViewControl;
  25. set
  26. {
  27. _pdfViewControl = value;
  28. pageEditControl.pdfViewer = _pdfViewControl.PDFView;
  29. pageEditControl.LoadThumbnails(pageEditControl.pdfViewer);
  30. pageEditControl.isThumbInitialized = false;
  31. }
  32. }
  33. //When the order or total number of pages changes
  34. public event RoutedEventHandler PageMoved;
  35. public event EventHandler ExitPageEdit;
  36. public event EventHandler<bool> OnCanSaveChanged;
  37. public event EventHandler OnAnnotEditHandler;
  38. private double[] zoomLevelList = { 1f, 8f, 12f, 25, 33f, 50, 66f, 75, 100, 125, 150, 200, 300, 400, 600, 800, 1000 };
  39. #endregion
  40. public PageEditControl()
  41. {
  42. InitializeComponent();
  43. this.DataContext = this;
  44. pageEditControl.PageMoved -= PageEditControl_PageMoved;
  45. pageEditControl.PageMoved += PageEditControl_PageMoved;
  46. CPDFPageEditBarControl.PageEditEvent -= CPDFPageEditBarControl_PageEditEvent;
  47. CPDFPageEditBarControl.PageEditEvent += CPDFPageEditBarControl_PageEditEvent;
  48. pageEditControl.ExitPageEdit -= PageEditControl_ExitPageEdit;
  49. pageEditControl.ExitPageEdit += PageEditControl_ExitPageEdit;
  50. }
  51. #region Private Command Methods
  52. private void PageEditControl_ExitPageEdit(object sender, EventArgs e)
  53. {
  54. this.ExitPageEdit?.Invoke(this, EventArgs.Empty);
  55. }
  56. private void CPDFPageEditBarControl_PageEditEvent(object sender, string e)
  57. {
  58. pageEditControl.PageEdit(e);
  59. }
  60. private void PageEditControl_PageMoved(object sender, RoutedEventArgs e)
  61. {
  62. PageMoved?.Invoke(this, e);
  63. }
  64. #endregion
  65. }
  66. }