CPDFArrowControl.xaml.cs 1.9 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364
  1. using ComPDFKit.PDFAnnotation;
  2. using compdfkit_tools.Data;
  3. using compdfkit_tools.PDFControlUI;
  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.Common
  19. {
  20. /// <summary>
  21. /// CPDFArrowControlControl.xaml 的交互逻辑
  22. /// </summary>
  23. public partial class CPDFArrowControl : UserControl
  24. {
  25. public event EventHandler ArrowChanged;
  26. private LineType _lineType;
  27. public LineType LineType
  28. {
  29. get
  30. {
  31. return new LineType()
  32. {
  33. HeadLineType = CPDFAnnotationDictionary.GetLineTypeFromIndex[CPDFHeadArrowUI.SelectedIndex],
  34. TailLineType = CPDFAnnotationDictionary.GetLineTypeFromIndex[CPDFTailArrowUI.SelectedIndex]
  35. };
  36. }
  37. set
  38. {
  39. _lineType = value;
  40. CPDFHeadArrowUI.SelectedIndex = (int)_lineType.HeadLineType;
  41. CPDFTailArrowUI.SelectedIndex = (int)_lineType.TailLineType;
  42. }
  43. }
  44. public CPDFArrowControl()
  45. {
  46. InitializeComponent();
  47. CPDFHeadArrowUI.ArrowChanged += CPDFHeadArrowUI_ArrowChanged;
  48. CPDFTailArrowUI.ArrowChanged += CPDFTailArrowUI_ArrowChanged;
  49. }
  50. private void CPDFTailArrowUI_ArrowChanged(object sender, EventArgs e)
  51. {
  52. ArrowChanged?.Invoke(this, EventArgs.Empty);
  53. }
  54. private void CPDFHeadArrowUI_ArrowChanged(object sender, EventArgs e)
  55. {
  56. ArrowChanged?.Invoke((object)this, EventArgs.Empty);
  57. }
  58. }
  59. }