Robot.xaml.cs 5.0 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116
  1. using Aitex.Core.Common;
  2. using System.Windows;
  3. using System.Windows.Controls;
  4. using static athosCore.NiceRobotAction;
  5. namespace athosThemes.UserControls
  6. {
  7. /// <summary>
  8. /// Robot.xaml 的交互逻辑
  9. /// </summary>
  10. public partial class Robot : UserControl
  11. {
  12. public Robot()
  13. {
  14. InitializeComponent();
  15. }
  16. /// <summary>
  17. /// Blader1 WaferInfo
  18. /// </summary>
  19. public static readonly DependencyProperty Blade1WaferInfoProperty = DependencyProperty.Register("Blade1WaferInfo", typeof(WaferInfo), typeof(Robot));
  20. public WaferInfo Blade1WaferInfo
  21. {
  22. get => (WaferInfo)GetValue(Blade1WaferInfoProperty);
  23. set => SetValue(Blade1WaferInfoProperty, value);
  24. }
  25. /// <summary>
  26. /// Blader2 WaferInfo
  27. /// </summary>
  28. public static readonly DependencyProperty Blade2WaferInfoProperty = DependencyProperty.Register("Blade2WaferInfo", typeof(WaferInfo), typeof(Robot));
  29. public WaferInfo Blade2WaferInfo
  30. {
  31. get => (WaferInfo)GetValue(Blade2WaferInfoProperty);
  32. set => SetValue(Blade2WaferInfoProperty, value);
  33. }
  34. /// <summary>
  35. /// Blader1 Wafer
  36. /// </summary>
  37. public static readonly DependencyProperty Blade1WaferProperty = DependencyProperty.Register("Blade1Wafer", typeof(string), typeof(Robot));
  38. public string Blade1Wafer
  39. {
  40. get => (string)GetValue(Blade1WaferProperty);
  41. set => SetValue(Blade1WaferProperty, value);
  42. }
  43. /// <summary>
  44. /// Blader2 Wafer
  45. /// </summary>
  46. public static readonly DependencyProperty Blade2WaferProperty = DependencyProperty.Register("Blade2Wafer", typeof(string), typeof(Robot));
  47. public string Blade2Wafer
  48. {
  49. get => (string)GetValue(Blade2WaferProperty);
  50. set => SetValue(Blade2WaferProperty, value);
  51. }
  52. /// <summary>
  53. /// Blader1 伸缩动作
  54. /// </summary>
  55. public static readonly DependencyProperty Blade1RobotXActionProperty = DependencyProperty.Register(
  56. "Blade1RobotXAction", typeof(NiceWaferRobotXAction), typeof(Robot), new PropertyMetadata(NiceWaferRobotXAction.Blader1Retract1, Blade1RobotXActionPropertyChangedCallback));
  57. public NiceWaferRobotXAction Blade1RobotXAction
  58. {
  59. get => (NiceWaferRobotXAction)GetValue(Blade1RobotXActionProperty);
  60. set => SetValue(Blade1RobotXActionProperty, value);
  61. }
  62. private static void Blade1RobotXActionPropertyChangedCallback(DependencyObject d, DependencyPropertyChangedEventArgs e)
  63. {
  64. var control = d as Robot;
  65. var oldAct = (NiceWaferRobotXAction)e.OldValue;
  66. var newAct = (NiceWaferRobotXAction)e.NewValue;
  67. if (oldAct != newAct)
  68. {
  69. VisualStateManager.GoToState(control, newAct.ToString(), true);
  70. }
  71. }
  72. /// <summary>
  73. /// Blader2 伸缩动作
  74. /// </summary>
  75. public static readonly DependencyProperty Blade2RobotXActionProperty = DependencyProperty.Register(
  76. "Blade2RobotXAction", typeof(NiceWaferRobotXAction), typeof(Robot), new PropertyMetadata(NiceWaferRobotXAction.Blader2Retract1, Blade2RobotXActionPropertyChangedCallback));
  77. public NiceWaferRobotXAction Blade2RobotXAction
  78. {
  79. get => (NiceWaferRobotXAction)GetValue(Blade2RobotXActionProperty);
  80. set => SetValue(Blade2RobotXActionProperty, value);
  81. }
  82. private static void Blade2RobotXActionPropertyChangedCallback(DependencyObject d, DependencyPropertyChangedEventArgs e)
  83. {
  84. var control = d as Robot;
  85. var oldAct = (NiceWaferRobotXAction)e.OldValue;
  86. var newAct = (NiceWaferRobotXAction)e.NewValue;
  87. if (oldAct != newAct)
  88. {
  89. VisualStateManager.GoToState(control, newAct.ToString(), true);
  90. }
  91. }
  92. /// <summary>
  93. /// Robot整体旋转
  94. /// </summary>
  95. public static readonly DependencyProperty Blade1RobotTActionProperty = DependencyProperty.Register(
  96. "BladeRobotTAction", typeof(NiceWaferRobotTAction), typeof(Robot), new PropertyMetadata(NiceWaferRobotTAction.T_Origin, BladeRobotTActionPropertyChangedCallback));
  97. public NiceWaferRobotTAction BladeRobotTAction
  98. {
  99. get => (NiceWaferRobotTAction)GetValue(Blade1RobotTActionProperty);
  100. set => SetValue(Blade1RobotTActionProperty, value);
  101. }
  102. private static void BladeRobotTActionPropertyChangedCallback(DependencyObject d, DependencyPropertyChangedEventArgs e)
  103. {
  104. var control = d as Robot;
  105. var oldAct = (NiceWaferRobotTAction)e.OldValue;
  106. var newAct = (NiceWaferRobotTAction)e.NewValue;
  107. if (oldAct != newAct)
  108. {
  109. VisualStateManager.GoToState(control, newAct.ToString(), true);
  110. }
  111. }
  112. }
  113. }