using CyberX8_Core;
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>
    /// PufLoaderControl.xaml 的交互逻辑
    /// </summary>
    public partial class PufLoaderControl : UserControl
    {
        public PufLoaderControl()
        {
            InitializeComponent();
        }

        public static readonly DependencyProperty Puf1WaferAProperty = DependencyProperty.Register("Puf1WaferA", typeof(WaferInfo), typeof(PufLoaderControl));
        public WaferInfo Puf1WaferA
        {
            get => (WaferInfo)GetValue(Puf1WaferAProperty);
            set => SetValue(Puf1WaferAProperty, value);
        }

        public static readonly DependencyProperty Puf1WaferBProperty = DependencyProperty.Register("Puf1WaferB", typeof(WaferInfo), typeof(PufLoaderControl));
        public WaferInfo Puf1WaferB
        {
            get => (WaferInfo)GetValue(Puf1WaferBProperty);
            set => SetValue(Puf1WaferBProperty, value);
        }

        public static readonly DependencyProperty LoaderWaferAProperty = DependencyProperty.Register("LoaderWaferA", typeof(WaferInfo), typeof(PufLoaderControl));
        public WaferInfo LoaderWaferA
        {
            get => (WaferInfo)GetValue(LoaderWaferAProperty);
            set => SetValue(LoaderWaferAProperty, value);
        }
        public static readonly DependencyProperty LoaderWaferBProperty = DependencyProperty.Register("LoaderWaferB", typeof(WaferInfo), typeof(PufLoaderControl));
        public WaferInfo LoaderWaferB
        {
            get => (WaferInfo)GetValue(LoaderWaferBProperty);
            set => SetValue(LoaderWaferBProperty, value);
        }
        /// <summary>
        /// Loader的sideA开启状态
        /// </summary>
        public static readonly DependencyProperty WaferVisibleAProperty = DependencyProperty.Register("WaferVisibleA", typeof(bool), typeof(PufLoaderControl));
        public bool WaferVisibleA
        {
            get => (bool)GetValue(WaferVisibleAProperty);
            set => SetValue(WaferVisibleAProperty, value);
        }
        /// <summary>
        /// Loader的sideB开启状态
        /// </summary>
        public static readonly DependencyProperty WaferVisibleBProperty = DependencyProperty.Register("WaferVisibleB", typeof(bool), typeof(PufLoaderControl));
        public bool WaferVisibleB
        {
            get => (bool)GetValue(WaferVisibleBProperty);
            set => SetValue(WaferVisibleBProperty, value);
        }

        public static readonly DependencyProperty CurrentLoaderAXLocationProperty = DependencyProperty.Register("CurrentLoaderAXLocation", typeof(PufControl.LoaderXLocation), typeof(PufLoaderControl),
          new PropertyMetadata(PufControl.LoaderXLocation.Parker));
        public PufControl.LoaderXLocation CurrentLoaderAXLocation
        {
            get { return (PufControl.LoaderXLocation)this.GetValue(CurrentLoaderAXLocationProperty); }
            set
            {
                this.SetValue(CurrentLoaderAXLocationProperty, value);
            }
        }

        public static readonly DependencyProperty CurrentLoaderBXLocationProperty = DependencyProperty.Register("CurrentLoaderBXLocation", typeof(PufControl.LoaderXLocation), typeof(PufLoaderControl),
        new PropertyMetadata(PufControl.LoaderXLocation.Parker));
        public PufControl.LoaderXLocation CurrentLoaderBXLocation
        {
            get { return (PufControl.LoaderXLocation)this.GetValue(CurrentLoaderBXLocationProperty); }
            set
            {
                this.SetValue(CurrentLoaderBXLocationProperty, value);
            }
        }

        public static readonly DependencyProperty CurrentLoaderARotationProperty = DependencyProperty.Register("CurrentLoaderARotation", typeof(PufControl.LoaderRotation), typeof(PufLoaderControl),
       new PropertyMetadata(PufControl.LoaderRotation.Origin));
        public PufControl.LoaderRotation CurrentLoaderARotation
        {
            get { return (PufControl.LoaderRotation)this.GetValue(CurrentLoaderARotationProperty); }
            set
            {
                this.SetValue(CurrentLoaderARotationProperty, value);
            }
        }

        public static readonly DependencyProperty CurrentLoaderBRotationProperty = DependencyProperty.Register("CurrentLoaderBRotation", typeof(PufControl.LoaderRotation), typeof(PufLoaderControl),
       new PropertyMetadata(PufControl.LoaderRotation.Origin));
        public PufControl.LoaderRotation CurrentLoaderBRotation
        {
            get { return (PufControl.LoaderRotation)this.GetValue(CurrentLoaderBRotationProperty); }
            set
            {
                this.SetValue(CurrentLoaderBRotationProperty, value);
            }
        }
        /// <summary>
        /// Loader Rotation UI 动画位置
        /// </summary>
        public static readonly DependencyProperty CurrentLoaderRotationProperty = DependencyProperty.Register("CurrentLoaderRotation", typeof(LoaderControl.LoaderRotation), typeof(PufLoaderControl));
        public LoaderControl.LoaderRotation CurrentLoaderRotation
        {
            get { return (LoaderControl.LoaderRotation)this.GetValue(CurrentLoaderRotationProperty); }
            set
            {
                this.SetValue(CurrentLoaderRotationProperty, value);
            }
        }
        /// <summary>
        /// Puf1 Rotation UI 位置
        /// </summary>
        public static readonly DependencyProperty Puf1RotationPositionProperty = DependencyProperty.Register("Puf1RotationPosition", typeof(double), typeof(PufLoaderControl));
        public double Puf1RotationPosition
        {
            get { return (double)this.GetValue(Puf1RotationPositionProperty); }
            set
            {
                this.SetValue(Puf1RotationPositionProperty, value);
            }
        }
        /// <summary>
        /// Loader1 Rotation UI 位置
        /// </summary>
        public static readonly DependencyProperty Loader1RotationPositionProperty = DependencyProperty.Register("Loader1RotationPosition", typeof(double), typeof(PufLoaderControl));
        public double Loader1RotationPosition
        {
            get { return (double)this.GetValue(Loader1RotationPositionProperty); }
            set
            {
                this.SetValue(Loader1RotationPositionProperty, value);
            }
        }       
        /// <summary>
        /// Puf1 Flip UI 位置
        /// </summary>
        public static readonly DependencyProperty Puf1FlipPositionProperty = DependencyProperty.Register("Puf1FlipPosition", typeof(double), typeof(PufLoaderControl));
        public double Puf1FlipPosition
        {
            get { return (double)this.GetValue(Puf1FlipPositionProperty); }
            set
            {
                this.SetValue(Puf1FlipPositionProperty, value);
            }
        }

        private void Puf1Control_MouseLeftButtonUp(object sender, MouseButtonEventArgs e)
        {

            GlobalEvents.OnSwitchFixedTabItem("HardWare", "Puf", "Puf1ServiceScreen");
        }

        private void LoaderControl_MouseLeftButtonUp(object sender, MouseButtonEventArgs e)
        {
            GlobalEvents.OnSwitchFixedTabItem("HardWare", "Loader", "LoaderSetup");
        }
    }
}