using Aitex.Core.Common;
using MECF.Framework.Common.OperationCenter;
using System;
using System.Collections.Generic;
using System.Linq;
using System.Reflection;
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 PunkHPX8_Themes.UserControls
{
    /// 
    /// PlatingCellStatusControl.xaml 的交互逻辑
    /// 
    public partial class PlatingCellStatusControl : UserControl
    {
        public PlatingCellStatusControl()
        {
            InitializeComponent();
        }
        public static readonly DependencyProperty ModuleNameProperty = DependencyProperty.Register(
         "ModuleName", typeof(string), typeof(PlatingCellStatusControl), new FrameworkPropertyMetadata("", FrameworkPropertyMetadataOptions.AffectsRender));
        /// 
        /// 模块名称
        /// 
        public string ModuleName
        {
            get
            {
                return (string)this.GetValue(ModuleNameProperty);
            }
            set
            {
                this.SetValue(ModuleNameProperty, value);
            }
        }
        public static readonly DependencyProperty ChemistryProperty = DependencyProperty.Register(
           "Chemistry", typeof(string), typeof(PlatingCellStatusControl), new FrameworkPropertyMetadata("", FrameworkPropertyMetadataOptions.AffectsRender));
        /// 
        /// Chemistry
        /// 
        public string Chemistry
        {
            get
            {
                return (string)this.GetValue(ChemistryProperty);
            }
            set
            {
                this.SetValue(ChemistryProperty, value);
            }
        }
        public static readonly DependencyProperty VerticalStationProperty = DependencyProperty.Register(
            "VerticalStation", typeof(string), typeof(PlatingCellStatusControl), new FrameworkPropertyMetadata("", FrameworkPropertyMetadataOptions.AffectsRender));
        /// 
        /// VerticalStation
        /// 
        public string VerticalStation
        {
            get
            {
                return (string)this.GetValue(VerticalStationProperty);
            }
            set
            {
                this.SetValue(VerticalStationProperty, value);
            }
        }
        public static readonly DependencyProperty WaferSizeListProperty = DependencyProperty.Register(
            "WaferSizeList", typeof(List), typeof(PlatingCellStatusControl), new FrameworkPropertyMetadata(null, FrameworkPropertyMetadataOptions.AffectsRender));
        /// 
        ///WaferSizeList
        /// 
        public List WaferSizeList
        {
            get
            {
                return (List)this.GetValue(WaferSizeListProperty);
            }
            set
            {
                this.SetValue(WaferSizeListProperty, value);
            }
        }
        public static readonly DependencyProperty SelectedWaferSizeProperty = DependencyProperty.Register(
         "SelectedWaferSize", typeof(int), typeof(PlatingCellStatusControl), new FrameworkPropertyMetadata(150, FrameworkPropertyMetadataOptions.AffectsRender));
        /// 
        ///SelectedWaferSize
        /// 
        public int SelectedWaferSize
        {
            get
            {
                return (int)this.GetValue(SelectedWaferSizeProperty);
            }
            set
            {
                this.SetValue(SelectedWaferSizeProperty, value);
            }
        }
        public static readonly DependencyProperty ClamshellSensorProperty = DependencyProperty.Register(
            "ClamshellSensor", typeof(double), typeof(PlatingCellStatusControl), new FrameworkPropertyMetadata(0.0, FrameworkPropertyMetadataOptions.AffectsRender));
        /// 
        /// ClamshellSensor
        /// 
        public double ClamshellSensor
        {
            get
            {
                return (double)this.GetValue(ClamshellSensorProperty);
            }
            set
            {
                this.SetValue(ClamshellSensorProperty, value);
            }
        }
        public static readonly DependencyProperty IsClamshellOpenProperty = DependencyProperty.Register(
           "IsClamshellOpen", typeof(bool), typeof(PlatingCellStatusControl), new FrameworkPropertyMetadata(false, FrameworkPropertyMetadataOptions.AffectsRender));
        /// 
        /// IsClamshellOpen
        /// 
        public bool IsClamshellOpen
        {
            get
            {
                return (bool)this.GetValue(IsClamshellOpenProperty);
            }
            set
            {
                this.SetValue(IsClamshellOpenProperty, value);
            }
        }
        public static readonly DependencyProperty IsClamshellCloseProperty = DependencyProperty.Register(
           "IsClamshellClose", typeof(bool), typeof(PlatingCellStatusControl), new FrameworkPropertyMetadata(false, FrameworkPropertyMetadataOptions.AffectsRender));
        /// 
        /// IsClamshellClose
        /// 
        public bool IsClamshellClose
        {
            get
            {
                return (bool)this.GetValue(IsClamshellCloseProperty);
            }
            set
            {
                this.SetValue(IsClamshellCloseProperty, value);
            }
        }
        public static readonly DependencyProperty IsAngleTiltProperty = DependencyProperty.Register(
          "IsAngleTilt", typeof(bool), typeof(PlatingCellStatusControl), new FrameworkPropertyMetadata(false, FrameworkPropertyMetadataOptions.AffectsRender));
        /// 
        /// IsAngleTilt
        /// 
        public bool IsAngleTilt
        {
            get
            {
                return (bool)this.GetValue(IsAngleTiltProperty);
            }
            set
            {
                this.SetValue(IsAngleTiltProperty, value);
            }
        }
        public static readonly DependencyProperty IsAngleVerticalProperty = DependencyProperty.Register(
         "IsAngleVertical", typeof(bool), typeof(PlatingCellStatusControl), new FrameworkPropertyMetadata(false, FrameworkPropertyMetadataOptions.AffectsRender));
        /// 
        /// IsAngleVertical
        /// 
        public bool IsAngleVertical
        {
            get
            {
                return (bool)this.GetValue(IsAngleVerticalProperty);
            }
            set
            {
                this.SetValue(IsAngleVerticalProperty, value);
            }
        }
        public static readonly DependencyProperty InputRotationSpeedProperty = DependencyProperty.Register(
           "InputRotationSpeed", typeof(int), typeof(PlatingCellStatusControl), new FrameworkPropertyMetadata(0, FrameworkPropertyMetadataOptions.AffectsRender));
        /// 
        /// InputRotationSpeed
        /// 
        public int InputRotationSpeed
        {
            get
            {
                return (int)this.GetValue(InputRotationSpeedProperty);
            }
            set
            {
                this.SetValue(InputRotationSpeedProperty, value);
            }
        }
        public static readonly DependencyProperty InputRotationTimeProperty = DependencyProperty.Register(
           "InputRotationTime", typeof(int), typeof(PlatingCellStatusControl), new FrameworkPropertyMetadata(0, FrameworkPropertyMetadataOptions.AffectsRender));
        /// 
        /// InputRotationTime
        /// 
        public int InputRotationTime
        {
            get
            {
                return (int)this.GetValue(InputRotationTimeProperty);
            }
            set
            {
                this.SetValue(InputRotationTimeProperty, value);
            }
        }
        private void ClamshellOpen_Click(object sender, RoutedEventArgs e)
        {
            InvokeClient.Instance.Service.DoOperation($"{ModuleName}.ClamShellOpen");
        }
        private void ClamshellClose_Click(object sender, RoutedEventArgs e)
        {
            InvokeClient.Instance.Service.DoOperation($"{ModuleName}.ClamShellClose");
        }
        private void AngleTilt_Click(object sender, RoutedEventArgs e)
        {
            InvokeClient.Instance.Service.DoOperation($"{ModuleName}.HeadtTilt");
        }
        private void AngleVertical_Click(object sender, RoutedEventArgs e)
        {
            InvokeClient.Instance.Service.DoOperation($"{ModuleName}.HeadVertical");
        }
        private void RotationStart_Click(object sender, RoutedEventArgs e)
        {
            InvokeClient.Instance.Service.DoOperation($"{ModuleName}.StartRotation", InputRotationSpeed, InputRotationTime);
        }
        private void RotationStop_Click(object sender, RoutedEventArgs e)
        {
            InvokeClient.Instance.Service.DoOperation($"{ModuleName}.StopRotation");
        }
        private void WaferSize_SelectionChanged(object sender, SelectionChangedEventArgs e)
        {
            InvokeClient.Instance.Service.DoOperation($"{ModuleName}.SetPlatingCellWaferSize", cbox.SelectedItem.ToString());
        }
    }
}