MeasurePropertyControl.xaml.cs 3.1 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100
  1. using Compdfkit_Tools.Measure.Property;
  2. using Compdfkit_Tools.PDFControl;
  3. using ComPDFKitViewer.AnnotEvent;
  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.Measure
  19. {
  20. /// <summary>
  21. /// MeasurePropertyControl.xaml 的交互逻辑
  22. /// </summary>
  23. public partial class MeasurePropertyControl : UserControl
  24. {
  25. private UIElement currentPanel = null;
  26. public MeasurePropertyControl()
  27. {
  28. InitializeComponent();
  29. }
  30. public void SetPropertyForMeasureCreate(AnnotHandlerEventArgs Args, AnnotAttribEvent attribEvent)
  31. {
  32. if (Args == null)
  33. {
  34. ClearMeasurePanel();
  35. return;
  36. }
  37. switch (Args.EventType)
  38. {
  39. case AnnotArgsType.LineMeasure:
  40. StraightnessProperty straightnessProperty = new StraightnessProperty();
  41. if (attribEvent != null)
  42. {
  43. straightnessProperty.SetAnnotEventData(attribEvent);
  44. }
  45. else
  46. {
  47. straightnessProperty.SetAnnotArgsData((LineMeasureArgs)Args);
  48. }
  49. currentPanel = straightnessProperty;
  50. break;
  51. case AnnotArgsType.PolyLineMeasure:
  52. MultilineProperty multilineProperty = new MultilineProperty();
  53. if (attribEvent != null)
  54. {
  55. multilineProperty.SetAnnotEventData(attribEvent);
  56. }
  57. else
  58. {
  59. multilineProperty.SetAnnotArgsData((PolyLineMeasureArgs)Args);
  60. }
  61. currentPanel = multilineProperty;
  62. break;
  63. case AnnotArgsType.PolygonMeasure:
  64. PolygonalProperty polygonalProperty = new PolygonalProperty();
  65. if (attribEvent != null)
  66. {
  67. polygonalProperty.SetAnnotEventData(attribEvent);
  68. }
  69. else
  70. {
  71. polygonalProperty.SetAnnotArgsData((PolygonMeasureArgs)Args);
  72. }
  73. currentPanel = polygonalProperty;
  74. break;
  75. default:
  76. break;
  77. }
  78. SetMeasurePanel(currentPanel);
  79. }
  80. private void SetMeasurePanel(UIElement newChild)
  81. {
  82. MeasurePropertyPanel.Child = newChild;
  83. }
  84. public void ClearMeasurePanel()
  85. {
  86. currentPanel = null;
  87. MeasurePropertyPanel.Child = null;
  88. }
  89. public void SetPorpertyForMeasureModify(AnnotAttribEvent annotEvent)
  90. {
  91. }
  92. }
  93. }