using MECF.Framework.Common.OperationCenter;
using PunkHPX8_Core;
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 PunkHPX8_Themes.UserControls
{
    /// 
    /// PufMotionCommandControl.xaml 的交互逻辑
    /// 
    public partial class PufMotionCommandControl : UserControl
    {
        public PufMotionCommandControl()
        {
            InitializeComponent();
        }
        public static readonly DependencyProperty ModuleNameProperty = DependencyProperty.Register("ModuleName", typeof(string), typeof(PufMotionCommandControl));
        /// 
        /// ModuleName
        /// 
        public string ModuleName
        {
            get
            {
                return (string)this.GetValue(ModuleNameProperty);
            }
            set
            {
                this.SetValue(ModuleNameProperty, value);
            }
        }
        public static readonly DependencyProperty VacuumAProperty = DependencyProperty.Register( "VacuumA", typeof(bool), typeof(PufMotionCommandControl));
        /// 
        /// VacuumA
        /// 
        public bool VacuumA
        {
            get
            {
                return (bool)this.GetValue(VacuumAProperty);
            }
            set
            {
                this.SetValue(VacuumAProperty, value);
            }
        }
        public static readonly DependencyProperty VacuumBProperty = DependencyProperty.Register("VacuumB", typeof(bool), typeof(PufMotionCommandControl));
        /// 
        /// VacuumB
        /// 
        public bool VacuumB
        {
            get
            {
                return (bool)this.GetValue(VacuumBProperty);
            }
            set
            {
                this.SetValue(VacuumBProperty, value);
            }
        }
        public static readonly DependencyProperty VacuumAValueProperty = DependencyProperty.Register("VacuumAValue", typeof(double), typeof(PufMotionCommandControl));
        /// 
        /// VacuumAValue
        /// 
        public double VacuumAValue
        {
            get
            {
                return (double)this.GetValue(VacuumAValueProperty);
            }
            set
            {
                this.SetValue(VacuumAValueProperty, value);
            }
        }
        public static readonly DependencyProperty VacuumBValueProperty = DependencyProperty.Register("VacuumBValue", typeof(double), typeof(PufMotionCommandControl));
        /// 
        /// VacuumBValue
        /// 
        public double VacuumBValue
        {
            get
            {
                return (double)this.GetValue(VacuumBValueProperty);
            }
            set
            {
                this.SetValue(VacuumBValueProperty, value);
            }
        }
        public static readonly DependencyProperty VacuumACheckedProperty = DependencyProperty.Register("VacuumAChecked", typeof(bool), typeof(PufMotionCommandControl));
        /// 
        /// VacuumAChecked
        /// 
        public bool VacuumAChecked
        {
            get
            {
                return (bool)this.GetValue(VacuumACheckedProperty);
            }
            set
            {
                this.SetValue(VacuumACheckedProperty, value);
            }
        }
        public static readonly DependencyProperty VacuumBCheckedProperty = DependencyProperty.Register("VacuumBChecked", typeof(bool), typeof(PufMotionCommandControl));
        /// 
        /// VacuumBChecked
        /// 
        public bool VacuumBChecked
        {
            get
            {
                return (bool)this.GetValue(VacuumBCheckedProperty);
            }
            set
            {
                this.SetValue(VacuumBCheckedProperty, value);
            }
        }
        #region button 事件
        private void AllMotorOn_Click(object sender, RoutedEventArgs e)
        {
            InvokeClient.Instance.Service.DoOperation($"{ModuleName}.AllMotorOn");
        }
        private void AllMotorOff_Click(object sender, RoutedEventArgs e)
        {
            InvokeClient.Instance.Service.DoOperation($"{ModuleName}.AllMotorOff");
        }
        private void HomePuf_Click(object sender, RoutedEventArgs e)
        {
            InvokeClient.Instance.Service.DoOperation($"{ModuleName}.Home");
        }
        private void VacuumA_Click(object sender, RoutedEventArgs e)
        {
            InvokeClient.Instance.Service.DoOperation($"{ModuleName}.VacuumAOn", "VacuumAChecked", VacuumAChecked);
        }
        #endregion
        private void VacuumB_Click(object sender, RoutedEventArgs e)
        {
            InvokeClient.Instance.Service.DoOperation($"{ModuleName}.VacuumBOn", "VacuumBChecked", VacuumBChecked);
        }
    }
}