1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465 |
- using System;
- using System.Collections.Generic;
- using System.Linq;
- using System.Text;
- using System.Threading.Tasks;
- using Wayne.Lib.StateEngine;
- using Wayne.Lib.StateEngine.Generic;
- namespace SinochemInternetPlusApp.States.CarPlateMode
- {
- public class ShowTrxListReadyForPay : TimeoutState<FuelingPoint>
- {
- private int requestId;
- protected override void Enter(StateEntry stateEntry, ref Transition transition)
- {
- base.Enter(stateEntry, ref transition);
-
- var validTrx = EpsTransactionQuery.GetValidCarPlateEpsTrxModels(
- Main.GetAllNozzlesOnThisSide(),
- ConfigurationValues.AlreadyDoneEpsTrxCountPerDisplay,
- Main.DebugLogger);
- DebugLog("validTrx: " + validTrx.Count());
- var text = Main.Eps.CreateDisplayTrxCommand(validTrx, out requestId, 0);
- if (Main.Eps.CarPlateHandler != null)
- {
- DebugLog(text);
- Main.Eps.CarPlateHandler.BroadcastMessageViaFdc(text);
- if (!Main.ContainsRequestId(requestId))
- Main.AddRequestId(requestId);
- }
- }
- protected override void HandleNonTimeoutEvent(StateEngineEvent stateEngineEvent, ref Transition transition)
- {
- if (stateEngineEvent.Type.Equals(EventType.DisplayResponseReceived))
- {
- var e = stateEngineEvent as GenericEvent<DisplayResponseEventArgs>;
- if (e != null && e.EventArgs != null)
- {
- if (requestId == e.EventArgs.DispResponse.RequestId)
- {
- e.Handled = true;
- if (Main.ContainsRequestId(requestId))
- Main.RemoveRequestId(requestId);
- transition = new Transition(this, TransitionType.Done);
- }
- }
- }
- }
- protected override void Timeout(ref Transition transition)
- {
- transition = new Transition(this, TransitionType.Timeout);
- }
- protected override int TimeoutInterval =>
- TimeoutValues.GetValueInMilliSec(TimeoutValues.FuelingPoint.CarPlateMode_ShowTrxListReadyForPay, 10);
- }
- }
|