123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279 |
- using MECF.Framework.Common.OperationCenter;
- 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 CyberX8_Themes.UserControls
- {
- /// <summary>
- /// TransporterOperationControl.xaml 的交互逻辑
- /// </summary>
- public partial class TransporterOperationControl : UserControl
- {
- #region 属性
- public static readonly DependencyProperty ModuleNameProperty = DependencyProperty.Register("ModuleName", typeof(string), typeof(TransporterOperationControl),
- new FrameworkPropertyMetadata("Transporter",new PropertyChangedCallback(ModuleNamePropertyChanged)));
- /// <summary>
- /// 模块名称
- /// </summary>
- public string ModuleName
- {
- get
- {
- return (string)this.GetValue(ModuleNameProperty);
- }
- set
- {
- this.SetValue(ModuleNameProperty, value);
- }
- }
- private static void ModuleNamePropertyChanged(DependencyObject d, DependencyPropertyChangedEventArgs e)
- {
- }
- public static readonly DependencyProperty ClampedProperty = DependencyProperty.Register(
- "Clamped", typeof(bool), typeof(TransporterOperationControl), new FrameworkPropertyMetadata(false, FrameworkPropertyMetadataOptions.AffectsRender));
- /// <summary>
- /// Clamped
- /// </summary>
- public bool Clamped
- {
- get
- {
- return (bool)this.GetValue(ClampedProperty);
- }
- set
- {
- this.SetValue(ClampedProperty, value);
- }
- }
- public static readonly DependencyProperty UnclampedProperty = DependencyProperty.Register(
- "Unclamped", typeof(bool), typeof(TransporterOperationControl), new FrameworkPropertyMetadata(false, FrameworkPropertyMetadataOptions.AffectsRender));
- /// <summary>
- /// Unclamped
- /// </summary>
- public bool Unclamped
- {
- get
- {
- return (bool)this.GetValue(UnclampedProperty);
- }
- set
- {
- this.SetValue(UnclampedProperty, value);
- }
- }
- public static readonly DependencyProperty LockedProperty = DependencyProperty.Register(
- "Locked", typeof(bool), typeof(TransporterOperationControl), new FrameworkPropertyMetadata(false, FrameworkPropertyMetadataOptions.AffectsRender));
- /// <summary>
- /// Locked
- /// </summary>
- public bool Locked
- {
- get
- {
- return (bool)this.GetValue(LockedProperty);
- }
- set
- {
- this.SetValue(LockedProperty, value);
- }
- }
- public static readonly DependencyProperty UnlockedProperty = DependencyProperty.Register(
- "Unlocked", typeof(bool), typeof(TransporterOperationControl), new FrameworkPropertyMetadata(false, FrameworkPropertyMetadataOptions.AffectsRender));
- /// <summary>
- /// Unlocked
- /// </summary>
- public bool Unlocked
- {
- get
- {
- return (bool)this.GetValue(UnlockedProperty);
- }
- set
- {
- this.SetValue(UnlockedProperty, value);
- }
- }
- public static readonly DependencyProperty DripOpenedProperty = DependencyProperty.Register(
- "DripOpened", typeof(bool), typeof(TransporterOperationControl), new FrameworkPropertyMetadata(false, FrameworkPropertyMetadataOptions.AffectsRender));
- /// <summary>
- /// DripOpened
- /// </summary>
- public bool DripOpened
- {
- get
- {
- return (bool)this.GetValue(DripOpenedProperty);
- }
- set
- {
- this.SetValue(DripOpenedProperty, value);
- }
- }
- public static readonly DependencyProperty DripClosedProperty = DependencyProperty.Register(
- "DripClosed", typeof(bool), typeof(TransporterOperationControl), new FrameworkPropertyMetadata(false, FrameworkPropertyMetadataOptions.AffectsRender));
- /// <summary>
- /// DripClosed
- /// </summary>
- public bool DripClosed
- {
- get
- {
- return (bool)this.GetValue(DripClosedProperty);
- }
- set
- {
- this.SetValue(DripClosedProperty, value);
- }
- }
- public static readonly DependencyProperty DripHorizontalProperty = DependencyProperty.Register(
- "DripHorizontal", typeof(bool), typeof(TransporterOperationControl), new FrameworkPropertyMetadata(false, FrameworkPropertyMetadataOptions.AffectsRender));
- /// <summary>
- /// DripHorizontal
- /// </summary>
- public bool DripHorizontal
- {
- get
- {
- return (bool)this.GetValue(DripHorizontalProperty);
- }
- set
- {
- this.SetValue(DripHorizontalProperty, value);
- }
- }
- public static readonly DependencyProperty DripVerticalProperty = DependencyProperty.Register(
- "DripVertical", typeof(bool), typeof(TransporterOperationControl), new FrameworkPropertyMetadata(false, FrameworkPropertyMetadataOptions.AffectsRender));
- /// <summary>
- /// DripVertical
- /// </summary>
- public bool DripVertical
- {
- get
- {
- return (bool)this.GetValue(DripVerticalProperty);
- }
- set
- {
- this.SetValue(DripVerticalProperty, value);
- }
- }
- public static readonly DependencyProperty ManualModeProperty = DependencyProperty.Register(
- "ManualMode", typeof(bool), typeof(TransporterOperationControl), new FrameworkPropertyMetadata(false, FrameworkPropertyMetadataOptions.AffectsRender));
- /// <summary>
- /// ManualMode
- /// </summary>
- public bool ManualMode
- {
- get
- {
- return (bool)this.GetValue(ManualModeProperty);
- }
- set
- {
- this.SetValue(ManualModeProperty, value);
- }
- }
- public static readonly DependencyProperty TargetStationProperty = DependencyProperty.Register(
- "TargetStation", typeof(string), typeof(TransporterOperationControl), new FrameworkPropertyMetadata("", FrameworkPropertyMetadataOptions.AffectsRender));
- /// <summary>
- /// TargetStation
- /// </summary>
- public string TargetStation
- {
- get
- {
- return (string)this.GetValue(TargetStationProperty);
- }
- set
- {
- this.SetValue(TargetStationProperty, value);
- }
- }
- public static readonly DependencyProperty IsElevatorInUpPlaceProperty = DependencyProperty.Register(
- "IsElevatorInUpPlace", typeof(bool), typeof(TransporterOperationControl), new FrameworkPropertyMetadata(false, FrameworkPropertyMetadataOptions.AffectsRender));
- /// <summary>
- /// IsElevatorInUpPlace
- /// </summary>
- public bool IsElevatorInUpPlace
- {
- get
- {
- return (bool)this.GetValue(IsElevatorInUpPlaceProperty);
- }
- set
- {
- this.SetValue(IsElevatorInUpPlaceProperty, value);
- }
- }
- #endregion
- public TransporterOperationControl()
- {
- InitializeComponent();
- }
- private void Clamp_Click(object sender, RoutedEventArgs e)
- {
- if (!IsElevatorInUpPlace)
- {
- MessageBox.Show("Elevator is not in 'UP' place", "Clamp", MessageBoxButton.OK, MessageBoxImage.Error);
- return;
- }
- InvokeClient.Instance.Service.DoOperation($"{ModuleName}.Extend");
- }
- private void Unclamp_Click(object sender, RoutedEventArgs e)
- {
- if (!IsElevatorInUpPlace)
- {
- MessageBox.Show("Elevator is not in 'UP' place", "Clamp", MessageBoxButton.OK, MessageBoxImage.Error);
- return;
- }
- InvokeClient.Instance.Service.DoOperation($"{ModuleName}.Retract");
- }
- private void Lock_Click(object sender, RoutedEventArgs e)
- {
- InvokeClient.Instance.Service.DoOperation($"{ModuleName}.Lock");
- }
- private void Unlock_Click(object sender, RoutedEventArgs e)
- {
- InvokeClient.Instance.Service.DoOperation($"{ModuleName}.Unlock");
- }
- private void Pick_Click(object sender, RoutedEventArgs e)
- {
- if (string.IsNullOrEmpty(TargetStation))
- {
- MessageBox.Show("Gantry is not in station", "pick", MessageBoxButton.OK, MessageBoxImage.Error);
- return;
- }
- InvokeClient.Instance.Service.DoOperation($"{ModuleName}.PickUpFrom", TargetStation);
- }
- private void Place_Click(object sender, RoutedEventArgs e)
- {
- if (string.IsNullOrEmpty(TargetStation))
- {
- MessageBox.Show("Gantry is not in station", "place", MessageBoxButton.OK, MessageBoxImage.Error);
- return;
- }
- InvokeClient.Instance.Service.DoOperation($"{ModuleName}.PutDownTo", TargetStation);
- }
- }
- }
|