using System; using System.Collections.Generic; using Wayne.Lib.StateEngine; using Wayne.Lib.StateEngine.Generic; using WayneChina_IcCardReader_SinoChem.MessageEntity.Incoming; namespace SinochemInternetPlusApp.States.ICCardMode { internal class WaitForCardEject : TimeoutState { protected override void HandleNonTimeoutEvent(StateEngineEvent stateEngineEvent, ref Transition transition) { if (stateEngineEvent.Type.Equals(EventType.ReaderStateChanged)) { GenericEvent readerEvent = stateEngineEvent as GenericEvent; if (readerEvent != null && readerEvent.EventArgs != null) { if (readerEvent.EventArgs.CardReaderState.State == CardReaderState.Idle) { DebugLog("card ejected"); readerEvent.Handled = true; transition = new Transition(this, TransitionType.Done); } } } } protected override void Timeout(ref Transition transition) { transition = new Transition(this, TransitionType.Timeout); } /// /// Wait for IC card eject timeout, at least 60s /// protected override int TimeoutInterval => TimeoutValues.GetValueInMilliSec(TimeoutValues.FuelingPoint.ICCardMode_WaitForCardEject, 60); } }