CPDFArrowControl.xaml.cs 1.8 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657
  1. using ComPDFKit.Controls.Data;
  2. using System;
  3. using System.Windows;
  4. using System.Windows.Controls;
  5. namespace ComPDFKit.Controls.Common
  6. {
  7. public partial class CPDFArrowControl : UserControl
  8. {
  9. public event EventHandler ArrowChanged;
  10. private LineType _lineType;
  11. public LineType LineType
  12. {
  13. get
  14. {
  15. return new LineType()
  16. {
  17. HeadLineType = CPDFAnnotationDictionary.GetLineTypeFromIndex[CPDFHeadArrowUI.SelectedIndex],
  18. TailLineType = CPDFAnnotationDictionary.GetLineTypeFromIndex[CPDFTailArrowUI.SelectedIndex]
  19. };
  20. }
  21. set
  22. {
  23. _lineType = value;
  24. CPDFHeadArrowUI.SelectedIndex = (int)_lineType.HeadLineType;
  25. CPDFTailArrowUI.SelectedIndex = (int)_lineType.TailLineType;
  26. }
  27. }
  28. public CPDFArrowControl()
  29. {
  30. InitializeComponent();
  31. CPDFHeadArrowUI.ArrowChanged -= CPDFHeadArrowUI_ArrowChanged;
  32. CPDFTailArrowUI.ArrowChanged -= CPDFTailArrowUI_ArrowChanged;
  33. CPDFHeadArrowUI.ArrowChanged += CPDFHeadArrowUI_ArrowChanged;
  34. CPDFTailArrowUI.ArrowChanged += CPDFTailArrowUI_ArrowChanged;
  35. Loaded += CPDFArrowControl_Loaded;
  36. }
  37. private void CPDFArrowControl_Loaded(object sender, RoutedEventArgs e)
  38. {
  39. CPDFTailArrowUI.RotateContent(180);
  40. }
  41. private void CPDFTailArrowUI_ArrowChanged(object sender, EventArgs e)
  42. {
  43. ArrowChanged?.Invoke(this, EventArgs.Empty);
  44. }
  45. private void CPDFHeadArrowUI_ArrowChanged(object sender, EventArgs e)
  46. {
  47. ArrowChanged?.Invoke((object)this, EventArgs.Empty);
  48. }
  49. }
  50. }