PDFContentEditControl.xaml.cs 2.2 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273747576
  1. using ComPDFKitViewer.PdfViewer;
  2. using ComPDFKitViewer;
  3. using System;
  4. using System.Collections.Generic;
  5. using System.Linq;
  6. using System.Text;
  7. using System.Threading.Tasks;
  8. using System.Windows;
  9. using System.Windows.Controls;
  10. using System.Windows.Data;
  11. using System.Windows.Documents;
  12. using System.Windows.Input;
  13. using System.Windows.Media;
  14. using System.Windows.Media.Imaging;
  15. using System.Windows.Navigation;
  16. using System.Windows.Shapes;
  17. namespace Compdfkit_Tools.Edit
  18. {
  19. /// <summary>
  20. /// Interaction logic for PDFContentEditControl.xaml
  21. /// </summary>
  22. public partial class PDFContentEditControl : UserControl
  23. {
  24. private UIElement contentEditPanel = null;
  25. private UIElement tempContentEditPanel = null;
  26. private PDFImageEditControl PDFImageEditControl = new PDFImageEditControl();
  27. private PDFTextEditControl PDFTextEditControl = new PDFTextEditControl();
  28. public CPDFViewer PDFView { get; private set; }
  29. public PDFEditEvent EditEvent { get; set; }
  30. public PDFContentEditControl()
  31. {
  32. InitializeComponent();
  33. }
  34. public void InitWithPDFViewer(CPDFViewer newPDFView)
  35. {
  36. PDFView = newPDFView;
  37. PDFImageEditControl.InitWithPDFViewer(newPDFView);
  38. }
  39. public void SetPDFTextEditData(PDFEditEvent editEvent, bool isTemp = false)
  40. {
  41. if (!isTemp)
  42. {
  43. PDFTextEditControl.SetPDFTextEditData(editEvent);
  44. ContentEditContainer.Child = PDFTextEditControl;
  45. }
  46. else
  47. {
  48. PDFTextEditControl tempPDFTextEditControl = new PDFTextEditControl();
  49. tempPDFTextEditControl.SetPDFTextEditData(editEvent);
  50. ContentEditContainer.Child = tempPDFTextEditControl;
  51. }
  52. }
  53. public void ClearContentControl()
  54. {
  55. ContentEditContainer.Child = null;
  56. }
  57. public void SetPDFImageEditData(PDFEditEvent editEvent)
  58. {
  59. PDFImageEditControl.SetPDFImageEditData(editEvent);
  60. ContentEditContainer.Child = PDFImageEditControl;
  61. }
  62. public void RefreshThumb()
  63. {
  64. PDFImageEditControl?.SetImageThumb();
  65. }
  66. }
  67. }