123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151 |
- using OpenSEMI.ClientBase;
- using System;
- using System.Collections.Generic;
- using System.Linq;
- using System.Text;
- using System.Threading.Tasks;
- using System.Windows;
- using System.Windows.Controls;
- using System.Windows.Data;
- using System.Windows.Documents;
- using System.Windows.Input;
- using System.Windows.Media;
- using System.Windows.Media.Imaging;
- using System.Windows.Navigation;
- using System.Windows.Shapes;
- namespace CyberX8_Themes.UserControls
- {
- /// <summary>
- /// PufControl.xaml 的交互逻辑
- /// </summary>
- public partial class PufControl : UserControl
- {
- public enum LoaderXLocation
- {
- Parker = 0,
- Efem = 1,
- Loader = 2
- }
- public enum LoaderRotation
- {
- Origin=0,
- Reverse = 1
- }
- public PufControl()
- {
- InitializeComponent();
- }
- public static readonly DependencyProperty RotateTransformValueProperty = DependencyProperty.Register("RotateTransformValue", typeof(int), typeof(PufControl));
- public int RotateTransformValue
- {
- get { return (int)this.GetValue(RotateTransformValueProperty); }
- set { this.SetValue(RotateTransformValueProperty, value); }
- }
- public static readonly DependencyProperty PufNameProperty = DependencyProperty.Register("PufName", typeof(string), typeof(PufControl));
- public string PufName
- {
- get { return this.GetValue(PufNameProperty).ToString(); }
- set { this.SetValue(PufNameProperty, value); }
- }
- public static readonly DependencyProperty RobotWaferAProperty = DependencyProperty.Register("RobotWaferA", typeof(WaferInfo), typeof(PufControl));
- public WaferInfo RobotWaferA
- {
- get => (WaferInfo)GetValue(RobotWaferAProperty);
- set => SetValue(RobotWaferAProperty, value);
- }
- public static readonly DependencyProperty RobotWaferBProperty = DependencyProperty.Register("RobotWaferB", typeof(WaferInfo), typeof(PufControl));
- public WaferInfo RobotWaferB
- {
- get => (WaferInfo)GetValue(RobotWaferBProperty);
- set => SetValue(RobotWaferBProperty, value);
- }
- //public static readonly DependencyProperty IsPufChangeProperty = DependencyProperty.Register("IsPufChange", typeof(bool), typeof(PufControl));
- //public bool IsPufChange
- //{
- // get => (bool)GetValue(IsPufChangeProperty);
- // set => SetValue(IsPufChangeProperty, value);
- //}
- /// <summary>
- /// Puf Roation UI 动画位置
- /// </summary>
- public static readonly DependencyProperty CurrentXLocationProperty = DependencyProperty.Register("CurrentXLocation", typeof(LoaderXLocation), typeof(PufControl),
- new PropertyMetadata(LoaderXLocation.Parker, PositionChangedCallback));
- public LoaderXLocation CurrentXLocation
- {
- get { return (LoaderXLocation)this.GetValue(CurrentXLocationProperty); }
- set
- {
- this.SetValue(CurrentXLocationProperty, value);
- }
- }
- /// <summary>
- /// Puf Flip UI 动画位置
- /// </summary>
- public static readonly DependencyProperty CurrentRotationProperty = DependencyProperty.Register("CurrentRotation", typeof(LoaderRotation), typeof(PufControl),
- new PropertyMetadata(LoaderRotation.Origin, RotationChangedCallback));
- public LoaderRotation CurrentRotation
- {
- get { return (LoaderRotation)this.GetValue(CurrentRotationProperty); }
- set
- {
- this.SetValue(CurrentRotationProperty, value);
- }
- }
- /// <summary>
- /// Puf Rotation UI位置
- /// </summary>
- public static readonly DependencyProperty PufRotationPositionProperty = DependencyProperty.Register("PufRotationPosition", typeof(double), typeof(PufControl),
- new PropertyMetadata((double)15));
- public double PufRotationPosition
- {
- get { return (double)this.GetValue(PufRotationPositionProperty); }
- set
- {
- this.SetValue(PufRotationPositionProperty, value);
- }
- }
- /// <summary>
- /// Puf Flip UI位置
- /// </summary>
- public static readonly DependencyProperty PufFlipPositionProperty = DependencyProperty.Register("PufFlipPosition", typeof(double), typeof(PufControl),
- new PropertyMetadata((double)15));
- public double PufFlipPosition
- {
- get { return (double)this.GetValue(PufFlipPositionProperty); }
- set
- {
- this.SetValue(PufFlipPositionProperty, value);
- }
- }
- private static void PositionChangedCallback(DependencyObject d, DependencyPropertyChangedEventArgs e)
- {
- var newAct = (LoaderXLocation)e.NewValue;
- var control = d as PufControl;
- GoToPosition(control, newAct);
- }
- private static void RotationChangedCallback(DependencyObject d, DependencyPropertyChangedEventArgs e)
- {
- var newAct = (LoaderRotation)e.NewValue;
- var control = d as PufControl;
- GoToRotation(control, newAct);
- }
- private static void GoToPosition(Control control, LoaderXLocation location)
- {
- VisualStateManager.GoToElementState(control, location.ToString(), false);
- }
- private static void GoToRotation(Control control, LoaderRotation rotation)
- {
- VisualStateManager.GoToElementState(control, rotation.ToString(), false);
- }
- }
- }
|