123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279 |
- using System;
- using System.Collections.Generic;
- using System.Linq;
- using System.Text;
- using System.Windows;
- using System.Windows.Input;
- using Aitex.Core.Common.DeviceData;
- using Aitex.Core.UI.MVVM;
- using Aitex.Core.Util;
- using Aitex.Core.Utilities;
- using Aitex.Triton160.Common;
- using Aitex.Triton160.UI.Wcf;
- namespace Aitex.Triton160.UI.ViewModel
- {
- class LeakCheckViewModel : UIViewModelBase
- {
- public ICommand LeakCheckCommand
- {
- get;
- private set;
- }
- public ICommand AbortCommand
- {
- get;
- private set;
- }
- public ICommand DeleteCommand
- {
- get;
- private set;
- }
- public List<LeakCheckResultItem> LeakCheckResultList
- {
- get;
- set;
- }
- #region StateData
- [Subscription(StateData.IsAutoMode, SystemStateModule)]
- public bool IsAutoMode
- {
- get;
- set;
- }
- [Subscription(TritonDevice.PressureMeterChamber, SystemDeviceModule)]
- public AITPressureMeterData ChamberPressure
- {
- get;
- set;
- }
- [Subscription(StateData.PMState, SystemStateModule)]
- public int PMStatus
- {
- get;
- set;
- }
- [Subscription(StateData.LeakCheckElapseTime, SystemStateModule)]
- public string LeakCheckElapseTime
- {
- get;
- set;
- }
- #endregion
- #region logic display
- public bool IsManualMode
- {
- get
- {
- return !IsAutoMode;
- }
- }
- public bool IsEnableLeakCheck
- {
- get
- {
- return !IsAutoMode && (PMState)PMStatus == PMState.Idle;
- }
- }
-
- [IgnorePropertyChange]
- public string LeakCheckModeSetPoint
- {
- get; set;
- }
- public bool IsEnableGasLine
- {
- get
- {
- return LeakCheckModeSetPoint == "ChamberAndGasLine";
- }
- }
- [IgnorePropertyChange]
- public string LeakCheckPumpDownTimeSetPoint
- {
- get;
- set;
- }
- [IgnorePropertyChange]
- public string LeakCheckTimeSetPoint
- {
- get;
- set;
- }
- [IgnorePropertyChange]
- public bool EnableGasLine1
- {
- get;
- set;
- }
- [IgnorePropertyChange]
- public bool EnableGasLine2
- {
- get;
- set;
- }
- [IgnorePropertyChange]
- public bool EnableGasLine3
- {
- get;
- set;
- }
- [IgnorePropertyChange]
- public bool EnableGasLine4
- {
- get;
- set;
- }
- [IgnorePropertyChange]
- public bool EnableGasLine5
- {
- get;
- set;
- }
- public bool IsLeakCheck
- {
- get
- {
- return (PMState)PMStatus == PMState.LeakCheck;
- }
- }
- public string Status
- {
- get
- {
- return ((PMState) PMStatus).ToString();
- }
- }
- public string Pressure
- {
- get
- {
- return ChamberPressure==null ? "0" : ChamberPressure.FeedBack.ToString("F0") + ChamberPressure.Unit;
- }
- }
-
- [IgnorePropertyChange]
- public LeakCheckResultItem CurrentLeakCheckResultItem
- {
- get; set;
- }
- F_TRIG _trigLeakCheckFinished = new F_TRIG();
- #endregion
- public LeakCheckViewModel()
- : base("LeakCheckViewModel")
- {
- LeakCheckCommand = new DelegateCommand<object>(LeakCheck);
- AbortCommand = new DelegateCommand<object>(AbortLeakCheck);
- DeleteCommand = new DelegateCommand<object>(DeleteLeakCheck);
- LeakCheckModeSetPoint = LeakCheckMode.ChamberOnly.ToString();
- LeakCheckPumpDownTimeSetPoint = "3";
- LeakCheckTimeSetPoint = "3";
- EnableGasLine1 = true;
- EnableGasLine2 = true;
- EnableGasLine3 = true;
- EnableGasLine4 = true;
- EnableGasLine5 = true;
- InvokePropertyChanged("LeakCheckModeSetPoint");
- InvokePropertyChanged("LeakCheckPumpDownTimeSetPoint");
- InvokePropertyChanged("LeakCheckTimeSetPoint");
- InvokePropertyChanged("EnableGasLine1");
- InvokePropertyChanged("EnableGasLine2");
- InvokePropertyChanged("EnableGasLine3");
- InvokePropertyChanged("EnableGasLine4");
- InvokePropertyChanged("EnableGasLine5");
- }
- public void UpdateLeakCheckResult()
- {
- LeakCheckResultList = Triton160UiSystem.Instance.WCF.Query.GetHistoryLeakCheck();
- InvokePropertyChanged("LeakCheckResultList");
- }
- protected override void InvokeBeforeUpdateProperty(Dictionary<string, object> data)
- {
- _trigLeakCheckFinished.CLK = IsLeakCheck;
- if (_trigLeakCheckFinished.Q)
- {
- Application.Current.Dispatcher.Invoke(new Action(() =>
- {
- UpdateLeakCheckResult();
- }));
- }
- }
- private void LeakCheck(object param)
- {
- WcfClient.Instance.InvokeService_DoOperation(
- TritonOperation.LeakCheck.ToString(), new[]
- {
- LeakCheckPumpDownTimeSetPoint,
- LeakCheckTimeSetPoint,
- LeakCheckModeSetPoint,
- EnableGasLine1.ToString(),
- EnableGasLine2.ToString(),
- EnableGasLine3.ToString(),
- EnableGasLine4.ToString(),
- EnableGasLine5.ToString(),
- });
- }
- private void AbortLeakCheck(object param)
- {
- if (MessageBox.Show(Aitex.Triton160.UI.Properties.Resources.LeakCheckViewModel_AbortLeakCheck_DoYouWantToStopCurrentLeakCheckRunning, "JetPlasma", MessageBoxButton.YesNo) == MessageBoxResult.Yes)
- WcfClient.Instance.InvokeService_DoOperation(TritonOperation.Abort.ToString());
- }
- private void DeleteLeakCheck(object param)
- {
- if (CurrentLeakCheckResultItem == null)
- {
- MessageBox.Show(Aitex.Triton160.UI.Properties.Resources.LeakCheckViewModel_DeleteLeakCheck_DidNotSelectLeakCheckResult, "JetPlasma", MessageBoxButton.OK);
- return;
- }
- if (MessageBox.Show(Aitex.Triton160.UI.Properties.Resources.LeakCheckViewModel_DeleteLeakCheck_DoYouWantToDeleteCurrentLeakCheckResult, "JetPlasma", MessageBoxButton.YesNo) == MessageBoxResult.Yes)
- WcfClient.Instance.InvokeService_DoOperation(TritonOperation.DeleteLeakCheck.ToString(), CurrentLeakCheckResultItem.Id);
- UpdateLeakCheckResult();
- }
-
-
- }
- }
|