CPDFArrowControl.xaml.cs 1.6 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354
  1. using Compdfkit_Tools.Data;
  2. using System;
  3. using System.Windows;
  4. using System.Windows.Controls;
  5. namespace Compdfkit_Tools.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. Loaded += CPDFArrowControl_Loaded;
  34. }
  35. private void CPDFArrowControl_Loaded(object sender, RoutedEventArgs e)
  36. {
  37. CPDFTailArrowUI.RotateContent(180);
  38. }
  39. private void CPDFTailArrowUI_ArrowChanged(object sender, EventArgs e)
  40. {
  41. ArrowChanged?.Invoke(this, EventArgs.Empty);
  42. }
  43. private void CPDFHeadArrowUI_ArrowChanged(object sender, EventArgs e)
  44. {
  45. ArrowChanged?.Invoke((object)this, EventArgs.Empty);
  46. }
  47. }
  48. }