GuangChuanRobot.xaml.cs 5.7 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142
  1. using OpenSEMI.ClientBase;
  2. using System.Windows;
  3. using System.Windows.Controls;
  4. using System.Windows.Input;
  5. using Venus_Themes.CustomControls;
  6. using static Venus_Core.NiceRobotAction;
  7. namespace Venus_Themes.UserControls
  8. {
  9. /// <summary>
  10. /// GuangChuanRobot.xaml 的交互逻辑
  11. /// </summary>
  12. public partial class GuangChuanRobot : UserControl
  13. {
  14. public GuangChuanRobot()
  15. {
  16. InitializeComponent();
  17. }
  18. public static readonly DependencyProperty Blade1RobotWaferProperty = DependencyProperty.Register(
  19. "Blade1RobotWafer",
  20. typeof(WaferInfo),
  21. typeof(GuangChuanRobot));
  22. public WaferInfo Blade1RobotWafer
  23. {
  24. get => (WaferInfo)GetValue(Blade1RobotWaferProperty);
  25. set => SetValue(Blade1RobotWaferProperty, value);
  26. }
  27. public static readonly DependencyProperty Blade2RobotWaferProperty = DependencyProperty.Register(
  28. "Blade2RobotWafer",
  29. typeof(WaferInfo),
  30. typeof(GuangChuanRobot));
  31. public WaferInfo Blade2RobotWafer
  32. {
  33. get => (WaferInfo)GetValue(Blade2RobotWaferProperty);
  34. set => SetValue(Blade2RobotWaferProperty, value);
  35. }
  36. public static readonly DependencyProperty Blade1RobotXActionProperty = DependencyProperty.Register(
  37. "Blade1RobotXAction",
  38. typeof(NiceGuangChuanWaferRobotXAction),
  39. typeof(GuangChuanRobot),
  40. new PropertyMetadata(NiceGuangChuanWaferRobotXAction.Retract1, Blade1RobotXActionPropertyChangedCallback));
  41. public NiceGuangChuanWaferRobotXAction Blade1RobotXAction
  42. {
  43. get => (NiceGuangChuanWaferRobotXAction)GetValue(Blade1RobotXActionProperty);
  44. set => SetValue(Blade1RobotXActionProperty, value);
  45. }
  46. private static void Blade1RobotXActionPropertyChangedCallback(DependencyObject d, DependencyPropertyChangedEventArgs e)
  47. {
  48. var control = d as GuangChuanRobot;
  49. var oldAct = (NiceGuangChuanWaferRobotXAction)e.OldValue;
  50. var newAct = (NiceGuangChuanWaferRobotXAction)e.NewValue;
  51. if (oldAct != newAct)
  52. {
  53. VisualStateManager.GoToState(control, newAct.ToString(), true);
  54. }
  55. }
  56. public override void OnApplyTemplate()
  57. {
  58. base.OnApplyTemplate();
  59. VisualStateManager.GoToState(this, NiceGuangChuanWaferRobotXAction.Retract1.ToString(), true);
  60. VisualStateManager.GoToState(this, NiceGuangChuanWaferRobotXAction.Retract2.ToString(), true);
  61. }
  62. public static readonly DependencyProperty Blade2RobotXActionProperty = DependencyProperty.Register(
  63. "Blade2RobotXAction",
  64. typeof(NiceGuangChuanWaferRobotXAction),
  65. typeof(GuangChuanRobot),
  66. new PropertyMetadata(NiceGuangChuanWaferRobotXAction.Retract2, Blade2RobotXActionPropertyChangedCallback));
  67. public NiceGuangChuanWaferRobotXAction Blade2RobotXAction
  68. {
  69. get => (NiceGuangChuanWaferRobotXAction)GetValue(Blade2RobotXActionProperty);
  70. set => SetValue(Blade2RobotXActionProperty, value);
  71. }
  72. private static void Blade2RobotXActionPropertyChangedCallback(DependencyObject d, DependencyPropertyChangedEventArgs e)
  73. {
  74. var control = d as GuangChuanRobot;
  75. var oldAct = (NiceGuangChuanWaferRobotXAction)e.OldValue;
  76. var newAct = (NiceGuangChuanWaferRobotXAction)e.NewValue;
  77. if (oldAct != newAct)
  78. {
  79. VisualStateManager.GoToState(control, newAct.ToString(), true);
  80. }
  81. }
  82. public static readonly DependencyProperty BladeRobotTActionProperty = DependencyProperty.Register(
  83. "BladeRobotTAction",
  84. typeof(NiceGuangChuanWaferRobotTAction),
  85. typeof(GuangChuanRobot),
  86. new PropertyMetadata(NiceGuangChuanWaferRobotTAction.T_Origin, BladeRobotTActionPropertyChangedCallback));
  87. public NiceGuangChuanWaferRobotTAction BladeRobotTAction
  88. {
  89. get => (NiceGuangChuanWaferRobotTAction)GetValue(BladeRobotTActionProperty);
  90. set => SetValue(BladeRobotTActionProperty, value);
  91. }
  92. private static void BladeRobotTActionPropertyChangedCallback(DependencyObject d, DependencyPropertyChangedEventArgs e)
  93. {
  94. var control = d as GuangChuanRobot;
  95. var oldAct = (NiceGuangChuanWaferRobotTAction)e.OldValue;
  96. var newAct = (NiceGuangChuanWaferRobotTAction)e.NewValue;
  97. if (oldAct != newAct)
  98. {
  99. VisualStateManager.GoToState(control, newAct.ToString(), true);
  100. }
  101. }
  102. //public static readonly DependencyProperty Blade2RobotTActionProperty = DependencyProperty.Register(
  103. // "Blade2RobotTAction",
  104. // typeof(NiceGuangChuanWaferRobotTAction),
  105. // typeof(GuangChuanRobot),
  106. // new PropertyMetadata(NiceGuangChuanWaferRobotTAction.T_Origin, Blade2RobotTActionPropertyChangedCallback));
  107. //public NiceGuangChuanWaferRobotTAction Blade2RobotTAction
  108. //{
  109. // get => (NiceGuangChuanWaferRobotTAction)GetValue(Blade2RobotTActionProperty);
  110. // set => SetValue(Blade2RobotTActionProperty, value);
  111. //}
  112. //private static void Blade2RobotTActionPropertyChangedCallback(DependencyObject d, DependencyPropertyChangedEventArgs e)
  113. //{
  114. // var control = d as GuangChuanRobot;
  115. // var oldAct = (NiceGuangChuanWaferRobotTAction)e.OldValue;
  116. // var newAct = (NiceGuangChuanWaferRobotTAction)e.NewValue;
  117. // if (oldAct != newAct)
  118. // {
  119. // VisualStateManager.GoToState(control, newAct.ToString(), true);
  120. // }
  121. //}
  122. }
  123. }