PDFContentEditControl.xaml.cs 1.9 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859
  1. using ComPDFKit.Tool;
  2. using Compdfkit_Tools.PDFControl;
  3. using System.Windows.Controls;
  4. namespace Compdfkit_Tools.Edit
  5. {
  6. public partial class PDFContentEditControl : UserControl
  7. {
  8. private PDFImageEditControl PDFImageEditControl = new PDFImageEditControl();
  9. private PDFTextEditControl PDFTextEditControl = new PDFTextEditControl();
  10. public PDFViewControl ViewControl { get; private set; }
  11. public PDFEditParam EditEvent { get; set; }
  12. public PDFContentEditControl()
  13. {
  14. InitializeComponent();
  15. }
  16. public void InitWithPDFViewer(PDFViewControl newPDFView)
  17. {
  18. ViewControl = newPDFView;
  19. PDFImageEditControl.InitWithPDFViewer(newPDFView.PDFViewTool);
  20. PDFTextEditControl.InitWithPDFViewer(newPDFView.PDFViewTool);
  21. }
  22. public void SetPDFTextEditData(TextEditParam editEvent, bool isTemp = false)
  23. {
  24. if (!isTemp)
  25. {
  26. PDFTextEditControl.SetPDFTextEditData(editEvent);
  27. ContentEditContainer.Child = PDFTextEditControl;
  28. }
  29. else
  30. {
  31. PDFTextEditControl tempPDFTextEditControl = new PDFTextEditControl();
  32. tempPDFTextEditControl.InitWithPDFViewer(ViewControl.PDFViewTool);
  33. tempPDFTextEditControl.SetPDFTextEditData(editEvent);
  34. ContentEditContainer.Child = tempPDFTextEditControl;
  35. }
  36. }
  37. public void ClearContentControl()
  38. {
  39. ContentEditContainer.Child = null;
  40. }
  41. public void SetPDFImageEditData(ImageEditParam editEvent)
  42. {
  43. PDFImageEditControl.SetPDFImageEditData(editEvent);
  44. ContentEditContainer.Child = PDFImageEditControl;
  45. }
  46. public void RefreshThumb()
  47. {
  48. PDFImageEditControl?.SetImageThumb();
  49. }
  50. }
  51. }