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;
using static CyberX8_Themes.UserControls.PufControl;
namespace CyberX8_Themes.UserControls
{
    
    /// 
    /// LoaderControl.xaml 的交互逻辑
    /// 
    public partial class LoaderControl : UserControl
    {
        public enum LoaderRotation
        {
            TrnpA = 0,
            TrnpB = 1,
            Load = 2,
            Camera = 3,
            ServiceB = 4
        }
        public LoaderControl()
        {
            InitializeComponent();
        }
        public static readonly DependencyProperty WaferVisibleAProperty = DependencyProperty.Register("WaferVisibleA", typeof(bool), typeof(LoaderControl));
        public bool WaferVisibleA
        {
            get { return (bool)this.GetValue(WaferVisibleAProperty); }
            set { this.SetValue(WaferVisibleAProperty, value); }
        }
        public static readonly DependencyProperty WaferVisibleBProperty = DependencyProperty.Register("WaferVisibleB", typeof(bool), typeof(LoaderControl));
        public bool WaferVisibleB
        {
            get { return (bool)this.GetValue(WaferVisibleBProperty); }
            set { this.SetValue(WaferVisibleBProperty, value); }
        }
        public static readonly DependencyProperty LoaderWaferAProperty = DependencyProperty.Register("LoaderWaferA", typeof(WaferInfo), typeof(LoaderControl));
        public WaferInfo LoaderWaferA
        {
            get => (WaferInfo)GetValue(LoaderWaferAProperty);
            set => SetValue(LoaderWaferAProperty, value);
        }
        public static readonly DependencyProperty LoaderWaferBProperty = DependencyProperty.Register("LoaderWaferB", typeof(WaferInfo), typeof(LoaderControl));
        public WaferInfo LoaderWaferB
        {
            get => (WaferInfo)GetValue(LoaderWaferBProperty);
            set => SetValue(LoaderWaferBProperty, value);
        }
        /// 
        /// Load Rotation位置
        /// 
        public static readonly DependencyProperty CurrentRotationProperty = DependencyProperty.Register("CurrentRotation", typeof(LoaderRotation), typeof(LoaderControl),
            new PropertyMetadata(LoaderRotation.TrnpA, RotationChangedCallback));
        public LoaderRotation CurrentRotation
        {
            get { return (LoaderRotation)this.GetValue(CurrentRotationProperty); }
            set
            {
                this.SetValue(CurrentRotationProperty, value);
            }
        }
        //Looader Rotation动画触发
        private static void RotationChangedCallback(DependencyObject d, DependencyPropertyChangedEventArgs e)
        {
            var newAct = (LoaderRotation)e.NewValue;
            var control = d as LoaderControl;
            GoToRotation(control, newAct);
        }
        private static void GoToRotation(Control control, LoaderRotation rotation)
        {
            VisualStateManager.GoToElementState(control, rotation.ToString(), false);
        }
    }
}