FromPropertyControl.xaml.cs 4.0 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104
  1. using Compdfkit_Tools.Annotation.PDFAnnotationPanel.PDFAnnotationUI;
  2. using ComPDFKitViewer.AnnotEvent;
  3. using ComPDFKitViewer.PdfViewer;
  4. using System.Windows;
  5. using System.Windows.Controls;
  6. namespace Compdfkit_Tools.PDFControl
  7. {
  8. public partial class FromPropertyControl : UserControl
  9. {
  10. private CPDFViewer pdfViewer;
  11. private UIElement currentPanel = null;
  12. public FromPropertyControl()
  13. {
  14. InitializeComponent();
  15. }
  16. public void CleanProperty()
  17. {
  18. SetAnnotationPanel(null);
  19. }
  20. public void SetPropertyForType(WidgetArgs Args, AnnotAttribEvent e)
  21. {
  22. currentPanel = null;
  23. if (Args==null)
  24. {
  25. SetAnnotationPanel(currentPanel);
  26. return;
  27. }
  28. switch (Args.WidgetType)
  29. {
  30. case ComPDFKit.PDFAnnotation.Form.C_WIDGET_TYPE.WIDGET_PUSHBUTTON:
  31. PushButtonProperty pushButtonProperty = new PushButtonProperty();
  32. pushButtonProperty.SetProperty(Args, e, pdfViewer);
  33. currentPanel = pushButtonProperty;
  34. break;
  35. case ComPDFKit.PDFAnnotation.Form.C_WIDGET_TYPE.WIDGET_CHECKBOX:
  36. CheckBoxProperty checkBoxProperty = new CheckBoxProperty();
  37. checkBoxProperty.SetProperty(Args, e);
  38. currentPanel = checkBoxProperty;
  39. break;
  40. case ComPDFKit.PDFAnnotation.Form.C_WIDGET_TYPE.WIDGET_RADIOBUTTON:
  41. RadioButtonProperty radioBoxProperty = new RadioButtonProperty();
  42. radioBoxProperty.SetProperty(Args, e, pdfViewer);
  43. currentPanel = radioBoxProperty;
  44. break;
  45. case ComPDFKit.PDFAnnotation.Form.C_WIDGET_TYPE.WIDGET_TEXTFIELD:
  46. TextFieldProperty textFieldProperty = new TextFieldProperty();
  47. textFieldProperty.SetProperty(Args,e);
  48. currentPanel = textFieldProperty;
  49. break;
  50. case ComPDFKit.PDFAnnotation.Form.C_WIDGET_TYPE.WIDGET_COMBOBOX:
  51. ComboBoxProperty comboBoxProperty = new ComboBoxProperty();
  52. comboBoxProperty.SetProperty(Args, e);
  53. currentPanel = comboBoxProperty;
  54. break;
  55. case ComPDFKit.PDFAnnotation.Form.C_WIDGET_TYPE.WIDGET_LISTBOX:
  56. ListBoxProperty listBoxProperty = new ListBoxProperty();
  57. listBoxProperty.SetProperty(Args, e);
  58. currentPanel = listBoxProperty;
  59. break;
  60. case ComPDFKit.PDFAnnotation.Form.C_WIDGET_TYPE.WIDGET_SIGNATUREFIELDS:
  61. if (e==null)
  62. {
  63. CPDFSignatureUI signatureProperty = new CPDFSignatureUI();
  64. signatureProperty.SetFormProperty(Args, pdfViewer);
  65. currentPanel = signatureProperty;
  66. }
  67. else
  68. {
  69. SignatureProperty signatureProperty = new SignatureProperty();
  70. signatureProperty.SetProperty(Args, e);
  71. currentPanel = signatureProperty;
  72. }
  73. break;
  74. case ComPDFKit.PDFAnnotation.Form.C_WIDGET_TYPE.WIDGET_UNKNOWN:
  75. break;
  76. default:
  77. break;
  78. }
  79. SetAnnotationPanel(currentPanel);
  80. }
  81. private void SetAnnotationPanel(UIElement newChild)
  82. {
  83. FromPropertyPanel.Child = newChild;
  84. }
  85. public void SetPDFViewer(CPDFViewer pdfViewer)
  86. {
  87. this.pdfViewer = pdfViewer;
  88. }
  89. private void UserControl_Loaded(object sender, RoutedEventArgs e)
  90. {
  91. }
  92. private void UserControl_Unloaded(object sender, RoutedEventArgs e)
  93. {
  94. }
  95. }
  96. }