CPDFCloudUI.xaml.cs 3.1 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374757677787980818283848586878889909192939495
  1. using ComPDFKit.Controls.Data;
  2. using ComPDFKit.Controls.PDFControl;
  3. using ComPDFKit.PDFAnnotation;
  4. using ComPDFKit.PDFDocument;
  5. using ComPDFKit.Tool;
  6. using ComPDFKit.Tool.UndoManger;
  7. using System;
  8. using System.Windows.Controls;
  9. using System.Windows.Media;
  10. namespace ComPDFKit.Controls.PDFControlUI
  11. {
  12. /// <summary>
  13. /// Interaction logic for CPDFCloudUI.xaml
  14. /// </summary>
  15. public partial class CPDFCloudUI : UserControl
  16. {
  17. bool IsLoadedData = false;
  18. private AnnotParam annotParam;
  19. private CPDFAnnotation annotCore;
  20. private PDFViewControl viewControl;
  21. public event EventHandler<CPDFAnnotationData> PropertyChanged;
  22. private AnnotHistory GetHistory()
  23. {
  24. if(annotCore != null && annotCore.IsValid())
  25. {
  26. return new PolygonAnnotHistory();
  27. }
  28. return new AnnotHistory();
  29. }
  30. public CPDFCloudUI()
  31. {
  32. InitializeComponent();
  33. ctlBorderColorPicker.ColorChanged -= CtlBorderColorPicker_ColorChanged;
  34. ctlFillColorPicker.ColorChanged -= CtlFillColorPicker_ColorChanged;
  35. CPDFOpacityControl.OpacityChanged -= CPDFOpacityControl_OpacityChanged;
  36. ctlBorderColorPicker.ColorChanged += CtlBorderColorPicker_ColorChanged;
  37. ctlFillColorPicker.ColorChanged += CtlFillColorPicker_ColorChanged;
  38. CPDFOpacityControl.OpacityChanged += CPDFOpacityControl_OpacityChanged;
  39. }
  40. private void CPDFOpacityControl_OpacityChanged(object sender, EventArgs e)
  41. {
  42. throw new NotImplementedException();
  43. }
  44. private void CtlFillColorPicker_ColorChanged(object sender, EventArgs e)
  45. {
  46. throw new NotImplementedException();
  47. }
  48. private void CtlBorderColorPicker_ColorChanged(object sender, EventArgs e)
  49. {
  50. throw new NotImplementedException();
  51. }
  52. public void SetPresentAnnotAttrib(PolygonMeasureParam polygonParam, CPDFPolygonAnnotation annotation, CPDFDocument document, PDFViewControl view)
  53. {
  54. annotParam = polygonParam;
  55. annotCore = annotation;
  56. viewControl = view;
  57. }
  58. public CPDFAnnotationData GetPolygonData()
  59. {
  60. CPDFPolygonData polygonData = new CPDFPolygonData
  61. {
  62. AnnotationType = CPDFAnnotationType.Polygon,
  63. BorderColor = ((SolidColorBrush)ctlBorderColorPicker.Brush).Color,
  64. FillColor = ((SolidColorBrush)ctlFillColorPicker.Brush).Color,
  65. IsMeasured = false,
  66. Thickness = CPDFThicknessControl.Thickness,
  67. Opacity = CPDFOpacityControl.Opacity / 100,
  68. Note = NoteTextBox.Text
  69. };
  70. return polygonData;
  71. }
  72. private void UserControl_Loaded(object sender, System.Windows.RoutedEventArgs e)
  73. {
  74. IsLoadedData = true;
  75. }
  76. private void UserControl_Unloaded(object sender, System.Windows.RoutedEventArgs e)
  77. {
  78. IsLoadedData = false;
  79. }
  80. }
  81. }