PageEditControl.xaml.cs 2.3 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071
  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. private PDFViewControl _pdfViewControl;
  21. public PDFViewControl PDFViewControl
  22. {
  23. get => _pdfViewControl;
  24. set
  25. {
  26. _pdfViewControl = value;
  27. pageEditControl.pdfViewer = _pdfViewControl.PDFView;
  28. pageEditControl.LoadThumbnails(pageEditControl.pdfViewer);
  29. }
  30. }
  31. //When the order or total number of pages changes
  32. public event RoutedEventHandler PageMoved;
  33. public event EventHandler ExitPageEdit;
  34. public event EventHandler<bool> OnCanSaveChanged;
  35. public event EventHandler OnAnnotEditHandler;
  36. private double[] zoomLevelList = { 1f, 8f, 12f, 25, 33f, 50, 66f, 75, 100, 125, 150, 200, 300, 400, 600, 800, 1000 };
  37. public PageEditControl()
  38. {
  39. InitializeComponent();
  40. this.DataContext = this;
  41. pageEditControl.PageMoved -= PageEditControl_PageMoved;
  42. pageEditControl.PageMoved += PageEditControl_PageMoved;
  43. CPDFPageEditBarControl.PageEditEvent -= CPDFPageEditBarControl_PageEditEvent;
  44. CPDFPageEditBarControl.PageEditEvent += CPDFPageEditBarControl_PageEditEvent;
  45. pageEditControl.ExitPageEdit -= PageEditControl_ExitPageEdit;
  46. pageEditControl.ExitPageEdit += PageEditControl_ExitPageEdit;
  47. }
  48. private void PageEditControl_ExitPageEdit(object sender, EventArgs e)
  49. {
  50. this.ExitPageEdit?.Invoke(this, EventArgs.Empty);
  51. }
  52. private void CPDFPageEditBarControl_PageEditEvent(object sender, string e)
  53. {
  54. pageEditControl.PageEdit(e);
  55. }
  56. private void PageEditControl_PageMoved(object sender, RoutedEventArgs e)
  57. {
  58. PageMoved?.Invoke(this, e);
  59. }
  60. }
  61. }