SignatureProperty.xaml.cs 1.7 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253
  1. using ComPDFKit.PDFAnnotation;
  2. using ComPDFKit.PDFAnnotation.Form;
  3. using ComPDFKit.PDFDocument;
  4. using ComPDFKit.Tool;
  5. using ComPDFKit.Tool.Help;
  6. using System.Windows;
  7. using System.Windows.Controls;
  8. namespace Compdfkit_Tools.PDFControl
  9. {
  10. public partial class SignatureProperty : UserControl
  11. {
  12. private SignatureParam widgetParam = null;
  13. private CPDFSignatureWidget cPDFAnnotation = null;
  14. private PDFViewControl pdfViewerControl = null;
  15. private CPDFDocument cPDFDocument = null;
  16. bool IsLoadedData = false;
  17. public SignatureProperty()
  18. {
  19. InitializeComponent();
  20. }
  21. public void SetProperty(AnnotParam annotParam, CPDFAnnotation annotation, CPDFDocument doc, PDFViewControl cPDFViewer)
  22. {
  23. widgetParam = (SignatureParam)annotParam;
  24. cPDFAnnotation = (CPDFSignatureWidget)annotation;
  25. pdfViewerControl = cPDFViewer;
  26. cPDFDocument = doc;
  27. }
  28. private void UserControl_Loaded(object sender, RoutedEventArgs e)
  29. {
  30. FormFieldCombox.SelectedIndex = (int)ParamConverter.ConverterWidgetFormFlags(widgetParam.Flags, widgetParam.IsHidden);
  31. IsLoadedData = true;
  32. }
  33. private void UserControl_Unloaded(object sender, RoutedEventArgs e)
  34. {
  35. IsLoadedData = false;
  36. }
  37. private void FormFieldCombox_SelectionChanged(object sender, SelectionChangedEventArgs e)
  38. {
  39. if (IsLoadedData)
  40. {
  41. cPDFAnnotation.SetFlags(ParamConverter.GetFormFlags((ParamConverter.FormField)(sender as ComboBox).SelectedIndex, cPDFAnnotation));
  42. pdfViewerControl.PDFViewTool.GetCPDFViewer().UpDateAnnotFrame();
  43. }
  44. }
  45. }
  46. }