using LiveCharts;
using MECF.Framework.Common.OperationCenter;
using System;
using System.Collections.Generic;
using System.ComponentModel;
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
{
    /// 
    /// LoaderWaferHolderFlowControl.xaml 的交互逻辑
    /// 
    public partial class LoaderWaferHolderFlowControl : UserControl
    {
        #region 属性
        public static readonly DependencyProperty ModuleNameProperty = DependencyProperty.Register("ModuleName", typeof(string), typeof(LoaderWaferHolderFlowControl),
          new FrameworkPropertyMetadata("", FrameworkPropertyMetadataOptions.AffectsRender));
        /// 
        /// 模块名称
        /// 
        public string ModuleName
        {
            get
            {
                return (string)this.GetValue(ModuleNameProperty);
            }
            set
            {
                this.SetValue(ModuleNameProperty, value);
            }
        }
        public static readonly DependencyProperty LeakFlowProperty = DependencyProperty.Register(
       "LeakFlow", typeof(double), typeof(LoaderWaferHolderFlowControl), new FrameworkPropertyMetadata(0.00, FrameworkPropertyMetadataOptions.AffectsRender));
        /// 
        /// LeakFlow
        /// 
        public double LeakFlow
        {
            get
            {
                return (double)this.GetValue(LeakFlowProperty);
            }
            set
            {
                this.SetValue(LeakFlowProperty, value);
            }
        }
        public static readonly DependencyProperty LeakVacuumValueProperty = DependencyProperty.Register(
      "LeakVacuumValue", typeof(double), typeof(LoaderWaferHolderFlowControl), new FrameworkPropertyMetadata(0.00, FrameworkPropertyMetadataOptions.AffectsRender));
        /// 
        /// LeakVacuumValue
        /// 
        public double LeakVacuumValue
        {
            get
            {
                return (double)this.GetValue(LeakVacuumValueProperty);
            }
            set
            {
                this.SetValue(LeakVacuumValueProperty, value);
            }
        }
        public static readonly DependencyProperty LeakFlowClampProperty = DependencyProperty.Register(
           "LeakFlowClamp", typeof(bool), typeof(LoaderWaferHolderFlowControl), new FrameworkPropertyMetadata(false, FrameworkPropertyMetadataOptions.AffectsRender));
        /// 
        /// LeakFlowClamp
        /// 
        public bool LeakFlowClamp
        {
            get
            {
                return (bool)this.GetValue(LeakFlowClampProperty);
            }
            set
            {
                this.SetValue(LeakFlowClampProperty, value);
            }
        }
        public static readonly DependencyProperty LeakVacuumProperty = DependencyProperty.Register(
        "LeakVacuum", typeof(bool), typeof(LoaderWaferHolderFlowControl), new FrameworkPropertyMetadata(false, FrameworkPropertyMetadataOptions.AffectsRender));
        /// 
        /// LeakVacuum
        /// 
        public bool LeakVacuum
        {
            get
            {
                return (bool)this.GetValue(LeakVacuumProperty);
            }
            set
            {
                this.SetValue(LeakVacuumProperty, value);
            }
        }
        public static readonly DependencyProperty LeakStatusProperty = DependencyProperty.Register(
        "LeakStatus", typeof(string), typeof(LoaderWaferHolderFlowControl), new FrameworkPropertyMetadata("", FrameworkPropertyMetadataOptions.AffectsRender));
        /// 
        /// LeakStatus
        /// 
        public string LeakStatus
        {
            get
            {
                return (string)this.GetValue(LeakStatusProperty);
            }
            set
            {
                this.SetValue(LeakStatusProperty, value);
            }
        }
        public static readonly DependencyProperty LeakMajorProperty = DependencyProperty.Register("LeakMajor", typeof(double), typeof(LoaderWaferHolderFlowControl));
        /// 
        /// LeakMajor
        /// 
        public double LeakMajor
        {
            get
            {
                return (double)this.GetValue(LeakMajorProperty);
            }
            set
            {
                this.SetValue(LeakMajorProperty, value);
            }
        }
        public static readonly DependencyProperty LeakMinorProperty = DependencyProperty.Register("LeakMinor", typeof(double), typeof(LoaderWaferHolderFlowControl));
        /// 
        /// LeakMinor
        /// 
        public double LeakMinor
        {
            get
            {
                return (double)this.GetValue(LeakMinorProperty);
            }
            set
            {
                this.SetValue(LeakMinorProperty, value);
            }
        }
        public static readonly DependencyProperty ValueSeriesProperty = DependencyProperty.Register("ValueSeries", typeof(ChartValues), typeof(LoaderWaferHolderFlowControl),
            new FrameworkPropertyMetadata(new ChartValues(), FrameworkPropertyMetadataOptions.AffectsRender));
        /// 
        /// ValueSeries
        /// 
        public ChartValues ValueSeries
        {
            get
            {
                return (ChartValues)this.GetValue(ValueSeriesProperty);
            }
            set
            {
                this.SetValue(ValueSeriesProperty, value);
            }
        }
        public static readonly DependencyProperty LabelSeriesProperty = DependencyProperty.Register("LabelSeries", typeof(ChartValues), typeof(LoaderWaferHolderFlowControl),
            new FrameworkPropertyMetadata(new ChartValues(), FrameworkPropertyMetadataOptions.AffectsRender));
        /// 
        /// LabelSeries
        /// 
        public ChartValues LabelSeries
        {
            get
            {
                return (ChartValues)this.GetValue(LabelSeriesProperty);
            }
            set
            {
                this.SetValue(LabelSeriesProperty, value);
            }
        }
        public static readonly DependencyProperty IsFlowStartEnabledProperty = DependencyProperty.Register("IsFlowStartEnabled", typeof(bool), typeof(LoaderWaferHolderFlowControl),
            new FrameworkPropertyMetadata(true, FrameworkPropertyMetadataOptions.AffectsRender));
        /// 
        /// IsFlowStartEnabled
        /// 
        public bool IsFlowStartEnabled
        {
            get
            {
                return (bool)this.GetValue(IsFlowStartEnabledProperty);
            }
            set
            {
                this.SetValue(IsFlowStartEnabledProperty, value);
            }
        }
        public static readonly DependencyProperty IsFlowStopEnabledProperty = DependencyProperty.Register("IsFlowStopEnabled", typeof(bool), typeof(LoaderWaferHolderFlowControl),
           new FrameworkPropertyMetadata(false, FrameworkPropertyMetadataOptions.AffectsRender));
        /// 
        /// IsFlowStopEnabled
        /// 
        public bool IsFlowStopEnabled
        {
            get { return (bool)this.GetValue(IsFlowStopEnabledProperty);}
            set { this.SetValue(IsFlowStopEnabledProperty,value);}
        }
        #endregion
        public LoaderWaferHolderFlowControl()
        {
            InitializeComponent();
        }
        #region 按钮
        private void FlowClampOn_Click(object sender, RoutedEventArgs e)
        {
            InvokeClient.Instance.Service.DoOperation($"{ModuleName}.LeakFlowClampOn");
        }
        private void FlowClampOff_Click(object sender, RoutedEventArgs e)
        {
            InvokeClient.Instance.Service.DoOperation($"{ModuleName}.LeakFlowClampOff");
        }
        private void VacuumOn_Click(object sender, RoutedEventArgs e)
        {
            InvokeClient.Instance.Service.DoOperation($"{ModuleName}.LeakVacuumOn");
        }
        private void VacuumOff_Click(object sender, RoutedEventArgs e)
        {
            InvokeClient.Instance.Service.DoOperation($"{ModuleName}.LeakVacuumOff");
        }
        private void StartFlow_Click(object sender, RoutedEventArgs e)
        {
            ValueSeries.Clear();
            InvokeClient.Instance.Service.DoOperation($"{ModuleName}.StartFlowTest");
        }
        private void StopFlow_Click(object sender, RoutedEventArgs e)
        {
            InvokeClient.Instance.Service.DoOperation($"{ModuleName}.StopFlowTest");
        }
        #endregion
    }
}