PDFContentEditControl.xaml.cs 1.7 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657
  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. }
  21. public void SetPDFTextEditData(TextEditParam editEvent, bool isTemp = false)
  22. {
  23. if (!isTemp)
  24. {
  25. PDFTextEditControl.SetPDFTextEditData(editEvent);
  26. ContentEditContainer.Child = PDFTextEditControl;
  27. }
  28. else
  29. {
  30. PDFTextEditControl tempPDFTextEditControl = new PDFTextEditControl();
  31. tempPDFTextEditControl.SetPDFTextEditData(editEvent);
  32. ContentEditContainer.Child = tempPDFTextEditControl;
  33. }
  34. }
  35. public void ClearContentControl()
  36. {
  37. ContentEditContainer.Child = null;
  38. }
  39. public void SetPDFImageEditData(ImageEditParam editEvent)
  40. {
  41. PDFImageEditControl.SetPDFImageEditData(editEvent);
  42. ContentEditContainer.Child = PDFImageEditControl;
  43. }
  44. public void RefreshThumb()
  45. {
  46. PDFImageEditControl?.SetImageThumb();
  47. }
  48. }
  49. }