123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105 |
- using ComPDFKit.PDFAnnotation;
- using ComPDFKit.PDFDocument;
- using ComPDFKit.Tool;
- using Compdfkit_Tools.Annotation.PDFAnnotationPanel.PDFAnnotationUI;
- using System.Windows;
- using System.Windows.Controls;
- namespace Compdfkit_Tools.PDFControl
- {
- public partial class FromPropertyControl : UserControl
- {
- private PDFViewControl pdfViewerControl;
- private UIElement currentPanel = null;
- public FromPropertyControl()
- {
- InitializeComponent();
- }
- public void CleanProperty()
- {
- SetAnnotationPanel(null);
- }
- public void SetPropertyForType(AnnotParam annotParam, CPDFAnnotation annotation, CPDFDocument cPDFDocument)
- {
- currentPanel = null;
- if (annotParam == null|| !(annotParam is FormParm))
- {
- SetAnnotationPanel(currentPanel);
- return;
- }
- switch ((annotParam as FormParm).WidgetType)
- {
- case ComPDFKit.PDFAnnotation.Form.C_WIDGET_TYPE.WIDGET_PUSHBUTTON:
- PushButtonProperty pushButtonProperty = new PushButtonProperty();
- pushButtonProperty.SetProperty(annotParam, annotation, cPDFDocument, pdfViewerControl);
- currentPanel = pushButtonProperty;
- break;
- case ComPDFKit.PDFAnnotation.Form.C_WIDGET_TYPE.WIDGET_CHECKBOX:
- CheckBoxProperty checkBoxProperty = new CheckBoxProperty();
- checkBoxProperty.SetProperty(annotParam, annotation, cPDFDocument, pdfViewerControl);
- currentPanel = checkBoxProperty;
- break;
- case ComPDFKit.PDFAnnotation.Form.C_WIDGET_TYPE.WIDGET_RADIOBUTTON:
- RadioButtonProperty radioBoxProperty = new RadioButtonProperty();
- radioBoxProperty.SetProperty(annotParam, annotation, cPDFDocument, pdfViewerControl);
- currentPanel = radioBoxProperty;
- break;
- case ComPDFKit.PDFAnnotation.Form.C_WIDGET_TYPE.WIDGET_TEXTFIELD:
- TextFieldProperty textFieldProperty = new TextFieldProperty();
- textFieldProperty.SetProperty(annotParam, annotation, cPDFDocument, pdfViewerControl);
- currentPanel = textFieldProperty;
- break;
- case ComPDFKit.PDFAnnotation.Form.C_WIDGET_TYPE.WIDGET_COMBOBOX:
- ComboBoxProperty comboBoxProperty = new ComboBoxProperty();
- comboBoxProperty.SetProperty(annotParam, annotation, cPDFDocument, pdfViewerControl);
- currentPanel = comboBoxProperty;
- break;
- case ComPDFKit.PDFAnnotation.Form.C_WIDGET_TYPE.WIDGET_LISTBOX:
- ListBoxProperty listBoxProperty = new ListBoxProperty();
- listBoxProperty.SetProperty(annotParam, annotation, cPDFDocument, pdfViewerControl);
- currentPanel = listBoxProperty;
- break;
- case ComPDFKit.PDFAnnotation.Form.C_WIDGET_TYPE.WIDGET_SIGNATUREFIELDS:
- if (pdfViewerControl.PDFToolManager.GetToolType()==CPDFToolManager.ToolType.FormEdit)
- {
- CPDFSignatureUI signatureProperty = new CPDFSignatureUI();
- signatureProperty.SetFormProperty(annotParam, pdfViewerControl, annotation);
- currentPanel = signatureProperty;
- }
- else
- {
- SignatureProperty signatureProperty = new SignatureProperty();
- signatureProperty.SetProperty(annotParam, annotation, cPDFDocument, pdfViewerControl);
- currentPanel = signatureProperty;
- }
- break;
- case ComPDFKit.PDFAnnotation.Form.C_WIDGET_TYPE.WIDGET_UNKNOWN:
- break;
- default:
- break;
- }
- SetAnnotationPanel(currentPanel);
- }
- private void SetAnnotationPanel(UIElement newChild)
- {
- FromPropertyPanel.Child = newChild;
- }
- public void SetPDFViewer(PDFViewControl pdfViewer)
- {
- this.pdfViewerControl = pdfViewer;
- }
- private void UserControl_Loaded(object sender, RoutedEventArgs e)
- {
- }
- private void UserControl_Unloaded(object sender, RoutedEventArgs e)
- {
- }
- }
- }
|