123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220 |
- using Aitex.Core.UI.MVVM;
- using Aitex.Sorter.Common;
- using MECF.Framework.Common.OperationCenter;
- using System.Windows;
- using System.Windows.Controls;
- using System.Windows.Input;
- using MECF.Framework.Common.Equipment;
-
- namespace Aitex.Sorter.UI.Controls
- {
- /// <summary>
- /// LPStatus.xaml 的交互逻辑
- /// </summary>
- public partial class LPStatus : UserControl
- {
- public bool Placed
- {
- get { return (bool)GetValue(PlacedProperty); }
- set { SetValue(PlacedProperty, value); }
- }
- // Using a DependencyProperty as the backing store for Placed. This enables animation, styling, binding, etc...
- public static readonly DependencyProperty PlacedProperty =
- DependencyProperty.Register("Placed", typeof(bool), typeof(LPStatus), new PropertyMetadata(false));
- public bool Present
- {
- get { return (bool)GetValue(PresentProperty); }
- set { SetValue(PresentProperty, value); }
- }
- // Using a DependencyProperty as the backing store for Present. This enables animation, styling, binding, etc...
- public static readonly DependencyProperty PresentProperty =
- DependencyProperty.Register("Present", typeof(bool), typeof(LPStatus), new PropertyMetadata(false));
- public ModuleName Station
- {
- get { return (ModuleName)GetValue(StationSetProperty); }
- set { SetValue(StationSetProperty, value); }
- }
- // Using a DependencyProperty as the backing store for UnitName. This enables animation, styling, binding, etc...
- public static readonly DependencyProperty StationSetProperty =
- DependencyProperty.Register("Station", typeof(ModuleName), typeof(LPStatus), new PropertyMetadata(ModuleName.System));
- public string FoupID
- {
- get { return (string)GetValue(FoupIDProperty); }
- set { SetValue(FoupIDProperty, value); }
- }
- // Using a DependencyProperty as the backing store for FoupID. This enables animation, styling, binding, etc...
- public static readonly DependencyProperty FoupIDProperty =
- DependencyProperty.Register("FoupID", typeof(string), typeof(LPStatus), new PropertyMetadata(null));
- public string RFReader
- {
- get { return (string)GetValue(RFReaderProperty); }
- set { SetValue(RFReaderProperty, value); }
- }
- // Using a DependencyProperty as the backing store for RFReader. This enables animation, styling, binding, etc...
- public static readonly DependencyProperty RFReaderProperty =
- DependencyProperty.Register("RFReader", typeof(string), typeof(LPStatus), new PropertyMetadata(null));
- public string Status
- {
- get { return (string)GetValue(StatusProperty); }
- set { SetValue(StatusProperty, value); }
- }
- // Using a DependencyProperty as the backing store for Status. This enables animation, styling, binding, etc...
- public static readonly DependencyProperty StatusProperty =
- DependencyProperty.Register("Status", typeof(string), typeof(LPStatus), new PropertyMetadata(null));
- public string CassetteState
- {
- get { return (string)GetValue(CassetteStateProperty); }
- set { SetValue(CassetteStateProperty, value); }
- }
- // Using a DependencyProperty as the backing store for CassetteState. This enables animation, styling, binding, etc...
- public static readonly DependencyProperty CassetteStateProperty =
- DependencyProperty.Register("CassetteState", typeof(string), typeof(LPStatus), new PropertyMetadata(null));
- public string ClampStatus
- {
- get { return (string)GetValue(ClampStatusProperty); }
- set { SetValue(ClampStatusProperty, value); }
- }
- // Using a DependencyProperty as the backing store for ClampStatus. This enables animation, styling, binding, etc...
- public static readonly DependencyProperty ClampStatusProperty =
- DependencyProperty.Register("ClampStatus", typeof(string), typeof(LPStatus), new PropertyMetadata(null));
- public string FoupDoorStatus
- {
- get { return (string)GetValue(FoupDoorStatusProperty); }
- set { SetValue(FoupDoorStatusProperty, value); }
- }
- // Using a DependencyProperty as the backing store for FoupDoorStatus. This enables animation, styling, binding, etc...
- public static readonly DependencyProperty FoupDoorStatusProperty =
- DependencyProperty.Register("FoupDoorStatus", typeof(string), typeof(LPStatus), new PropertyMetadata(null));
- public bool LoadPortLoaded
- {
- get { return (bool)GetValue(LoadPortLoadedProperty); }
- set { SetValue(LoadPortLoadedProperty, value); }
- }
- // Using a DependencyProperty as the backing store for LoadPortLoaded. This enables animation, styling, binding, etc...
- public static readonly DependencyProperty LoadPortLoadedProperty =
- DependencyProperty.Register("LoadPortLoaded", typeof(bool), typeof(LPStatus), new PropertyMetadata(false));
- public bool LoadPortUnloaded
- {
- get { return (bool)GetValue(LoadPortUnloadedProperty); }
- set { SetValue(LoadPortUnloadedProperty, value); }
- }
- // Using a DependencyProperty as the backing store for LoadPortUnloaded. This enables animation, styling, binding, etc...
- public static readonly DependencyProperty LoadPortUnloadedProperty =
- DependencyProperty.Register("LoadPortUnloaded", typeof(bool), typeof(LPStatus), new PropertyMetadata(false));
- public bool IsAlarm
- {
- get { return (bool)GetValue(IsAlarmProperty); }
- set { SetValue(IsAlarmProperty, value); }
- }
- // Using a DependencyProperty as the backing store for IsAlarm. This enables animation, styling, binding, etc...
- public static readonly DependencyProperty IsAlarmProperty =
- DependencyProperty.Register("IsAlarm", typeof(bool), typeof(LPStatus), new PropertyMetadata(false));
- public int RoutManagerState
- {
- get { return (int)GetValue(RoutManagerStateProperty); }
- set { SetValue(RoutManagerStateProperty, value); }
- }
- // Using a DependencyProperty as the backing store for RoutManagerState. This enables animation, styling, binding, etc...
- public static readonly DependencyProperty RoutManagerStateProperty =
- DependencyProperty.Register("RoutManagerState", typeof(int), typeof(LPStatus), new PropertyMetadata((int)RtState.Init, StateChangedCallback));
- public bool IsAutoMode
- {
- get { return (bool)GetValue(IsAutoModeProperty); }
- set { SetValue(IsAutoModeProperty, value); }
- }
- // Using a DependencyProperty as the backing store for IsAutoMode. This enables animation, styling, binding, etc...
- public static readonly DependencyProperty IsAutoModeProperty =
- DependencyProperty.Register("IsAutoMode", typeof(bool), typeof(LPStatus), new PropertyMetadata(false, StateChangedCallback));
- public bool IsManualMode
- {
- get { return (bool)GetValue(IsManualModeProperty); }
- set { SetValue(IsManualModeProperty, value); }
- }
- // Using a DependencyProperty as the backing store for IsAutoMode. This enables animation, styling, binding, etc...
- public static readonly DependencyProperty IsManualModeProperty =
- DependencyProperty.Register("IsManualMode", typeof(bool), typeof(LPStatus), new PropertyMetadata(false, StateChangedCallback));
- public static void StateChangedCallback(DependencyObject d, DependencyPropertyChangedEventArgs e)
- {
- var self = d as LPStatus;
- if (self.DeviceOperationCommand != null)
- {
- ((IDelegateCommand)self.DeviceOperationCommand).RaiseCanExecuteChanged();
- }
- if (self.RFReaderCommand != null)
- {
- ((IDelegateCommand)self.RFReaderCommand).RaiseCanExecuteChanged();
- }
- }
- public LPStatus()
- {
- InitializeComponent();
- DeviceOperationCommand = new DelegateCommand<string>(DeviceOperation, x => RoutManagerState != (int)RtState.Maintenance && !IsAutoMode);
- RFReaderCommand = new DelegateCommand<string>(RFReaderOperation, x => RoutManagerState != (int)RtState.Maintenance && !IsAutoMode);
- root.DataContext = this;
- }
- public ICommand DeviceOperationCommand
- {
- get;
- private set;
- }
- public ICommand RFReaderCommand
- {
- get;
- private set;
- }
- void DeviceOperation(string cmd)
- {
- var deviceName = Station.ToString();
- var param = new object[] { deviceName, cmd };
- InvokeClient.Instance.Service.DoOperation(OperationName.DeviceOperation.ToString(), param);
- }
- void RFReaderOperation(string cmd)
- {
- var deviceName = RFReader;
- var param = new object[] { deviceName, cmd };
- InvokeClient.Instance.Service.DoOperation(OperationName.DeviceOperation.ToString(), param);
- }
- }
- }
|