using Wayne.ForecourtControl.Fusion.StatusStateMachine.States; using Wayne.Lib.StateEngine; using Wayne.Lib.StateEngine.Generic; namespace Wayne.ForecourtControl.Fusion.ReadDeviceStatus.States { [StateDescription(StateDescriptionType.Summary, "Idle state")] [EventDescription(EventType.ReadDeviceStatus, BasicTransitionType.Done)] [EventDescription(EventType.GetConfiguration, TransitionType.ReadConfiguration)] class Idle : State { #region Overrides of State /// /// Override to receive incoming events. If the event is handled, the /// application must set the event.Handled = true. /// /// The event object that should be handled. /// Out parameter that should be set to either the reference to a transition object or null. protected override void HandleEvent(StateEngineEvent stateEngineEvent, ref Transition transition) { base.HandleEvent(stateEngineEvent, ref transition); if (stateEngineEvent.Type.Equals(EventType.ReadDeviceStatus)) { stateEngineEvent.Handled = true; transition = new Transition(this, BasicTransitionType.Done); } if (stateEngineEvent.Type.Equals(EventType.GetConfiguration)) { stateEngineEvent.Handled = true; Main.Configuration = new ConfigurationSet(); transition = new Transition(this, TransitionType.ReadConfiguration); } else { stateEngineEvent.Handled = true; DebugLog("Unhandled event set to handled !"); } } #endregion } }