FromPropertyControl.xaml.cs 4.4 KB

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