using OpenSEMI.ClientBase; using System.Windows; using System.Windows.Controls; using System.Windows.Input; using Venus_Themes.CustomControls; using static Venus_Core.NiceRobotAction; namespace Venus_Themes.UserControls { /// /// GuangChuanRobot.xaml 的交互逻辑 /// public partial class GuangChuanRobot : UserControl { public GuangChuanRobot() { InitializeComponent(); } public static readonly DependencyProperty Blade1RobotWaferProperty = DependencyProperty.Register( "Blade1RobotWafer", typeof(WaferInfo), typeof(GuangChuanRobot)); public WaferInfo Blade1RobotWafer { get => (WaferInfo)GetValue(Blade1RobotWaferProperty); set => SetValue(Blade1RobotWaferProperty, value); } public static readonly DependencyProperty Blade2RobotWaferProperty = DependencyProperty.Register( "Blade2RobotWafer", typeof(WaferInfo), typeof(GuangChuanRobot)); public WaferInfo Blade2RobotWafer { get => (WaferInfo)GetValue(Blade2RobotWaferProperty); set => SetValue(Blade2RobotWaferProperty, value); } public static readonly DependencyProperty Blade1RobotXActionProperty = DependencyProperty.Register( "Blade1RobotXAction", typeof(NiceGuangChuanWaferRobotXAction), typeof(GuangChuanRobot), new PropertyMetadata(NiceGuangChuanWaferRobotXAction.Retract1, Blade1RobotXActionPropertyChangedCallback)); public NiceGuangChuanWaferRobotXAction Blade1RobotXAction { get => (NiceGuangChuanWaferRobotXAction)GetValue(Blade1RobotXActionProperty); set => SetValue(Blade1RobotXActionProperty, value); } private static void Blade1RobotXActionPropertyChangedCallback(DependencyObject d, DependencyPropertyChangedEventArgs e) { var control = d as GuangChuanRobot; var oldAct = (NiceGuangChuanWaferRobotXAction)e.OldValue; var newAct = (NiceGuangChuanWaferRobotXAction)e.NewValue; if (oldAct != newAct) { VisualStateManager.GoToState(control, newAct.ToString(), true); } } public override void OnApplyTemplate() { base.OnApplyTemplate(); VisualStateManager.GoToState(this, NiceGuangChuanWaferRobotXAction.Retract1.ToString(), true); VisualStateManager.GoToState(this, NiceGuangChuanWaferRobotXAction.Retract2.ToString(), true); } public static readonly DependencyProperty Blade2RobotXActionProperty = DependencyProperty.Register( "Blade2RobotXAction", typeof(NiceGuangChuanWaferRobotXAction), typeof(GuangChuanRobot), new PropertyMetadata(NiceGuangChuanWaferRobotXAction.Retract2, Blade2RobotXActionPropertyChangedCallback)); public NiceGuangChuanWaferRobotXAction Blade2RobotXAction { get => (NiceGuangChuanWaferRobotXAction)GetValue(Blade2RobotXActionProperty); set => SetValue(Blade2RobotXActionProperty, value); } private static void Blade2RobotXActionPropertyChangedCallback(DependencyObject d, DependencyPropertyChangedEventArgs e) { var control = d as GuangChuanRobot; var oldAct = (NiceGuangChuanWaferRobotXAction)e.OldValue; var newAct = (NiceGuangChuanWaferRobotXAction)e.NewValue; if (oldAct != newAct) { VisualStateManager.GoToState(control, newAct.ToString(), true); } } public static readonly DependencyProperty BladeRobotTActionProperty = DependencyProperty.Register( "BladeRobotTAction", typeof(NiceGuangChuanWaferRobotTAction), typeof(GuangChuanRobot), new PropertyMetadata(NiceGuangChuanWaferRobotTAction.T_Origin, BladeRobotTActionPropertyChangedCallback)); public NiceGuangChuanWaferRobotTAction BladeRobotTAction { get => (NiceGuangChuanWaferRobotTAction)GetValue(BladeRobotTActionProperty); set => SetValue(BladeRobotTActionProperty, value); } private static void BladeRobotTActionPropertyChangedCallback(DependencyObject d, DependencyPropertyChangedEventArgs e) { var control = d as GuangChuanRobot; var oldAct = (NiceGuangChuanWaferRobotTAction)e.OldValue; var newAct = (NiceGuangChuanWaferRobotTAction)e.NewValue; if (oldAct != newAct) { VisualStateManager.GoToState(control, newAct.ToString(), true); } } } }