using MECF.Framework.Common.DataCenter; using MECF.Framework.Common.OperationCenter; using CyberX8_Core; using System; using System.Collections.Generic; using System.Linq; using System.Runtime.CompilerServices; 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 { /// /// PufStationCommandControl.xaml 的交互逻辑 /// public partial class PufStationCommandControl : UserControl { public PufStationCommandControl() { InitializeComponent(); } public static readonly DependencyProperty ModuleNameProperty = DependencyProperty.Register("ModuleName", typeof(string), typeof(PufStationCommandControl)); /// /// 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(PufStationCommandControl)); /// /// 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(PufStationCommandControl)); /// /// 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(PufStationCommandControl)); /// /// 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(PufStationCommandControl)); /// /// VacuumBValue /// public double VacuumBValue { get { return (double)this.GetValue(VacuumBValueProperty); } set { this.SetValue(VacuumBValueProperty, value); } } public static readonly DependencyProperty VacuumAStatusProperty = DependencyProperty.Register("VacuumAStatus", typeof(string), typeof(PufStationCommandControl)); /// /// VacuumAStatus /// public string VacuumAStatus { get { return (string)this.GetValue(VacuumAStatusProperty); } set { this.SetValue(VacuumAStatusProperty, value); } } public static readonly DependencyProperty VacuumBStatusProperty = DependencyProperty.Register("VacuumBStatus", typeof(string), typeof(PufStationCommandControl)); /// /// VacuumBStatus /// public string VacuumBStatus { get { return (string)this.GetValue(VacuumBStatusProperty); } set { this.SetValue(VacuumBStatusProperty, value); } } public static readonly DependencyProperty VacuumACheckedProperty = DependencyProperty.Register("VacuumAChecked", typeof(bool), typeof(PufStationCommandControl)); /// /// 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(PufStationCommandControl)); /// /// VacuumBChecked /// public bool VacuumBChecked { get { return (bool)this.GetValue(VacuumBCheckedProperty); } set { this.SetValue(VacuumBCheckedProperty, value); } } public static readonly DependencyProperty PickSelectedItemProperty = DependencyProperty.Register("PickSelectedItem", typeof(string), typeof(PufStationCommandControl)); /// /// PickSelectedItem /// public string PickSelectedItem { get { return (string)this.GetValue(PickSelectedItemProperty); } set { this.SetValue(PickSelectedItemProperty, value); } } public static readonly DependencyProperty PlaceSelectedItemProperty = DependencyProperty.Register("PlaceSelectedItem", typeof(string), typeof(PufStationCommandControl)); /// /// PlaceSelectedItem /// public string PlaceSelectedItem { get { return (string)this.GetValue(PlaceSelectedItemProperty); } set { this.SetValue(PlaceSelectedItemProperty, value); } } public static readonly DependencyProperty CombomboxItemSourceProperty = DependencyProperty.Register("CombomboxItemSource", typeof(List), typeof(PufStationCommandControl), new FrameworkPropertyMetadata(new List() {"SideA","SideB" }, FrameworkPropertyMetadataOptions.AffectsRender)); public List CombomboxItemSource { get { return (List)this.GetValue(CombomboxItemSourceProperty); } set { this.SetValue(CombomboxItemSourceProperty, value); } } #region button 事件 private void MoveToPark_Click(object sender, RoutedEventArgs e) { InvokeClient.Instance.Service.DoOperation($"{ModuleName}.MoveToPark"); } private void AllMotorOn_Click(object sender, RoutedEventArgs e) { InvokeClient.Instance.Service.DoOperation($"{ModuleName}.{MotionOperation.SwitchOn}"); } private void AllMotorOff_Click(object sender, RoutedEventArgs e) { InvokeClient.Instance.Service.DoOperation($"{ModuleName}.{MotionOperation.SwitchOff}"); } private void HomePuf_Click(object sender, RoutedEventArgs e) { InvokeClient.Instance.Service.DoOperation($"{ModuleName}.{MotionOperation.HomeAll}"); } private void Abort_Click(object sender, RoutedEventArgs e) { InvokeClient.Instance.Service.DoOperation($"{ModuleName}.Abort"); } private void Pick_Click(object sender, RoutedEventArgs e) { if(string.IsNullOrEmpty(PickSelectedItem)) { MessageBox.Show("please select pick item", "pick", MessageBoxButton.OK, MessageBoxImage.Error); return; } InvokeClient.Instance.Service.DoOperation($"{ModuleName}.Pick", PickSelectedItem); } private void Place_Click(object sender, RoutedEventArgs e) { if (string.IsNullOrEmpty(PlaceSelectedItem)) { MessageBox.Show("please select place item", "place", MessageBoxButton.OK, MessageBoxImage.Error); return; } InvokeClient.Instance.Service.DoOperation($"{ModuleName}.Place", PlaceSelectedItem); } private void MoveToRobot_Click(object sender, RoutedEventArgs e) { InvokeClient.Instance.Service.DoOperation($"{ModuleName}.MoveToRobot"); } private void VacuumA_Click(object sender, RoutedEventArgs e) { InvokeClient.Instance.Service.DoOperation($"{ModuleName}.VacuumAOn", "VacuumAChecked", !VacuumAChecked); } private void VacuumB_Click(object sender, RoutedEventArgs e) { InvokeClient.Instance.Service.DoOperation($"{ModuleName}.VacuumBOn", "VacuumBChecked", !VacuumBChecked); } private void ClearError_Click(object sender, RoutedEventArgs e) { InvokeClient.Instance.Service.DoOperation($"{ModuleName}.ClearError"); } #endregion } }