CPDFAnnotationControl.xaml.cs 2.1 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273
  1. using compdfkit_tools.PDFControl;
  2. using compdfkit_tools.PDFControlUI;
  3. using System;
  4. using System.Collections.Generic;
  5. using System.Linq;
  6. using System.Text;
  7. using System.Threading.Tasks;
  8. using System.Windows;
  9. using System.Windows.Controls;
  10. using System.Windows.Data;
  11. using System.Windows.Documents;
  12. using System.Windows.Input;
  13. using System.Windows.Media;
  14. using System.Windows.Media.Imaging;
  15. using System.Windows.Navigation;
  16. using System.Windows.Shapes;
  17. namespace compdfkit_tools.Annotation.PDFAnnotationControl
  18. {
  19. /// <summary>
  20. /// CPDFAnnotationControl.xaml 的交互逻辑
  21. /// </summary>
  22. public partial class CPDFAnnotationControl : UserControl
  23. {
  24. public CPDFAnnotationControl()
  25. {
  26. InitializeComponent();
  27. }
  28. /// <summary>
  29. /// 获取Bota工具
  30. /// </summary>
  31. /// <returns></returns>
  32. private UIElement GetAnnotationPanel()
  33. {
  34. return AnnotationPanelContainer.Child;
  35. }
  36. private void SetAnnotationPanel(UIElement newChild)
  37. {
  38. AnnotationPanelContainer.Child = newChild;
  39. }
  40. /// <summary>
  41. /// 展开Bota工具
  42. /// </summary>
  43. /// <param name="isExpand"></param>
  44. private void ExpandPanel(bool isExpand)
  45. {
  46. AnnotationPanelContainer.Visibility = isExpand ? Visibility.Visible : Visibility.Collapsed;
  47. }
  48. public void LoadAnnotationPanel(AnnotationProperties annotationProperties)
  49. {
  50. UIElement annotationPanel = GetAnnotationPanel();
  51. switch (annotationProperties)
  52. {
  53. case AnnotationProperties.Highlight:
  54. CPDFHighlightUI CPDFHighlightUI = new CPDFHighlightUI();
  55. SetAnnotationPanel(CPDFHighlightUI);
  56. ExpandPanel(true);
  57. break;
  58. case AnnotationProperties.Underline:
  59. break;
  60. case AnnotationProperties.Strikeout:
  61. break;
  62. default: throw new ArgumentException();
  63. }
  64. }
  65. }
  66. }