FromPropertyControl.xaml.cs 4.4 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120
  1. using compdfkit_tools.Annotation.PDFAnnotationPanel.PDFAnnotationUI;
  2. using compdfkit_tools.Form.Property;
  3. using ComPDFKitViewer.AnnotEvent;
  4. using ComPDFKitViewer.PdfViewer;
  5. using System;
  6. using System.Collections.Generic;
  7. using System.Linq;
  8. using System.Text;
  9. using System.Threading.Tasks;
  10. using System.Windows;
  11. using System.Windows.Controls;
  12. using System.Windows.Data;
  13. using System.Windows.Documents;
  14. using System.Windows.Input;
  15. using System.Windows.Media;
  16. using System.Windows.Media.Imaging;
  17. using System.Windows.Navigation;
  18. using System.Windows.Shapes;
  19. namespace compdfkit_tools.Form
  20. {
  21. /// <summary>
  22. /// FromPropertyControl.xaml 的交互逻辑
  23. /// </summary>
  24. public partial class FromPropertyControl : UserControl
  25. {
  26. private CPDFViewer pdfViewer;
  27. private UIElement currentPanel = null;
  28. public FromPropertyControl()
  29. {
  30. InitializeComponent();
  31. }
  32. public void CleanProperty()
  33. {
  34. SetAnnotationPanel(null);
  35. }
  36. public void SetPropertyForType(WidgetArgs Args, AnnotAttribEvent e)
  37. {
  38. currentPanel = null;
  39. if (Args==null)
  40. {
  41. SetAnnotationPanel(currentPanel);
  42. return;
  43. }
  44. switch (Args.WidgeType)
  45. {
  46. case ComPDFKit.PDFAnnotation.Form.C_WIDGET_TYPE.WIDGET_PUSHBUTTON:
  47. PushButtonProperty pushButtonProperty = new PushButtonProperty();
  48. pushButtonProperty.SetProperty(Args, e, pdfViewer);
  49. currentPanel = pushButtonProperty;
  50. break;
  51. case ComPDFKit.PDFAnnotation.Form.C_WIDGET_TYPE.WIDGET_CHECKBOX:
  52. CheckBoxProperty checkBoxProperty = new CheckBoxProperty();
  53. checkBoxProperty.SetProperty(Args, e);
  54. currentPanel = checkBoxProperty;
  55. break;
  56. case ComPDFKit.PDFAnnotation.Form.C_WIDGET_TYPE.WIDGET_RADIOBUTTON:
  57. RadioButtonProperty radioBoxProperty = new RadioButtonProperty();
  58. radioBoxProperty.SetProperty(Args, e, pdfViewer);
  59. currentPanel = radioBoxProperty;
  60. break;
  61. case ComPDFKit.PDFAnnotation.Form.C_WIDGET_TYPE.WIDGET_TEXTFIELD:
  62. TextFieldProperty textFieldProperty = new TextFieldProperty();
  63. textFieldProperty.SetProperty(Args,e);
  64. currentPanel = textFieldProperty;
  65. break;
  66. case ComPDFKit.PDFAnnotation.Form.C_WIDGET_TYPE.WIDGET_COMBOBOX:
  67. ComboBoxProperty comboBoxProperty = new ComboBoxProperty();
  68. comboBoxProperty.SetProperty(Args, e);
  69. currentPanel = comboBoxProperty;
  70. break;
  71. case ComPDFKit.PDFAnnotation.Form.C_WIDGET_TYPE.WIDGET_LISTBOX:
  72. ListBoxProperty listBoxProperty = new ListBoxProperty();
  73. listBoxProperty.SetProperty(Args, e);
  74. currentPanel = listBoxProperty;
  75. break;
  76. case ComPDFKit.PDFAnnotation.Form.C_WIDGET_TYPE.WIDGET_SIGNATUREFIELDS:
  77. if (e==null)
  78. {
  79. CPDFSignatureUI signatureProperty = new CPDFSignatureUI();
  80. signatureProperty.SetFormProperty(Args, pdfViewer);
  81. currentPanel = signatureProperty;
  82. }
  83. else
  84. {
  85. SignatureProperty signatureProperty = new SignatureProperty();
  86. signatureProperty.SetProperty(Args, e);
  87. currentPanel = signatureProperty;
  88. }
  89. break;
  90. case ComPDFKit.PDFAnnotation.Form.C_WIDGET_TYPE.WIDGET_UNKNOWN:
  91. break;
  92. default:
  93. break;
  94. }
  95. SetAnnotationPanel(currentPanel);
  96. }
  97. private void SetAnnotationPanel(UIElement newChild)
  98. {
  99. FromPropertyPanel.Child = newChild;
  100. }
  101. public void SetPDFViewer(CPDFViewer pdfViewer)
  102. {
  103. this.pdfViewer = pdfViewer;
  104. }
  105. private void UserControl_Loaded(object sender, RoutedEventArgs e)
  106. {
  107. }
  108. private void UserControl_Unloaded(object sender, RoutedEventArgs e)
  109. {
  110. }
  111. }
  112. }