FromPropertyControl.xaml.cs 3.2 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374757677787980818283848586878889909192939495969798
  1. using compdfkit_tools.Form.Property;
  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.Form
  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||e==null)
  39. {
  40. SetAnnotationPanel(currentPanel);
  41. return;
  42. }
  43. switch (Args.WidgeType)
  44. {
  45. case ComPDFKit.PDFAnnotation.Form.C_WIDGET_TYPE.WIDGET_PUSHBUTTON:
  46. break;
  47. case ComPDFKit.PDFAnnotation.Form.C_WIDGET_TYPE.WIDGET_CHECKBOX:
  48. CheckBoxProperty checkBoxProperty = new CheckBoxProperty();
  49. checkBoxProperty.SetProperty(Args, e);
  50. currentPanel = checkBoxProperty;
  51. break;
  52. case ComPDFKit.PDFAnnotation.Form.C_WIDGET_TYPE.WIDGET_RADIOBUTTON:
  53. RadioButtonProperty radioBoxProperty = new RadioButtonProperty();
  54. radioBoxProperty.SetProperty(Args, e, pdfViewer);
  55. currentPanel = radioBoxProperty;
  56. break;
  57. case ComPDFKit.PDFAnnotation.Form.C_WIDGET_TYPE.WIDGET_TEXTFIELD:
  58. TextFieldProperty textFieldProperty = new TextFieldProperty();
  59. textFieldProperty.SetProperty(Args,e);
  60. currentPanel = textFieldProperty;
  61. break;
  62. case ComPDFKit.PDFAnnotation.Form.C_WIDGET_TYPE.WIDGET_COMBOBOX:
  63. break;
  64. case ComPDFKit.PDFAnnotation.Form.C_WIDGET_TYPE.WIDGET_LISTBOX:
  65. break;
  66. case ComPDFKit.PDFAnnotation.Form.C_WIDGET_TYPE.WIDGET_SIGNATUREFIELDS:
  67. break;
  68. case ComPDFKit.PDFAnnotation.Form.C_WIDGET_TYPE.WIDGET_UNKNOWN:
  69. break;
  70. default:
  71. break;
  72. }
  73. SetAnnotationPanel(currentPanel);
  74. }
  75. private void SetAnnotationPanel(UIElement newChild)
  76. {
  77. FromPropertyPanel.Child = newChild;
  78. }
  79. public void SetPDFViewer(CPDFViewer pdfViewer)
  80. {
  81. this.pdfViewer = pdfViewer;
  82. }
  83. private void UserControl_Loaded(object sender, RoutedEventArgs e)
  84. {
  85. }
  86. private void UserControl_Unloaded(object sender, RoutedEventArgs e)
  87. {
  88. }
  89. }
  90. }