123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289 |
- 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
- {
- /// <summary>
- /// PufStationCommandControl.xaml 的交互逻辑
- /// </summary>
- public partial class PufStationCommandControl : UserControl
- {
- public PufStationCommandControl()
- {
- InitializeComponent();
- }
- public static readonly DependencyProperty ModuleNameProperty = DependencyProperty.Register("ModuleName", typeof(string), typeof(PufStationCommandControl));
- /// <summary>
- /// ModuleName
- /// </summary>
- 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));
- /// <summary>
- /// VacuumA
- /// </summary>
- 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));
- /// <summary>
- /// VacuumB
- /// </summary>
- 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));
- /// <summary>
- /// VacuumAValue
- /// </summary>
- 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));
- /// <summary>
- /// VacuumBValue
- /// </summary>
- 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));
- /// <summary>
- /// VacuumAStatus
- /// </summary>
- 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));
- /// <summary>
- /// VacuumBStatus
- /// </summary>
- 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));
- /// <summary>
- /// VacuumAChecked
- /// </summary>
- 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));
- /// <summary>
- /// VacuumBChecked
- /// </summary>
- 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));
- /// <summary>
- /// PickSelectedItem
- /// </summary>
- 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));
- /// <summary>
- /// PlaceSelectedItem
- /// </summary>
- public string PlaceSelectedItem
- {
- get
- {
- return (string)this.GetValue(PlaceSelectedItemProperty);
- }
- set
- {
- this.SetValue(PlaceSelectedItemProperty, value);
- }
- }
- public static readonly DependencyProperty CombomboxItemSourceProperty = DependencyProperty.Register("CombomboxItemSource", typeof(List<string>), typeof(PufStationCommandControl),
- new FrameworkPropertyMetadata(new List<string>() {"SideA","SideB" }, FrameworkPropertyMetadataOptions.AffectsRender));
- public List<string> CombomboxItemSource
- {
- get
- {
- return (List<string>)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
- }
- }
|