コード例 #1
0
        /// <summary>
        /// Enters the state.
        /// </summary>
        /// <param name="context">The event arguments pertaining to the transition into the state.</param>
        /// <param name="useHistory">Used by history states to reconstitute state history.</param>
        /// <remarks>
        /// This method is for use only by the North State Framework's internal logic.
        /// </remarks>
        protected internal virtual void enter(NSFStateMachineContext context, bool useHistory)
        {
            active = true;

            if (parentRegion != null)
            {
                parentRegion.setActiveSubstate(this);

                if (!parentRegion.isActive())
                {
                    parentRegion.enter(context, false);
                }
            }

            if (TopStateMachine.LoggingEnabled && LogEntry)
            {
                NSFTraceLog.PrimaryTraceLog.addTrace(NSFTraceTags.StateEnteredTag,
                                                     NSFTraceTags.StateMachineTag, TopStateMachine.Name,
                                                     NSFTraceTags.StateTag, Name);
            }

            // Update context to indicate entering this state
            context.EnteringState = this;
            context.ExitingState  = null;

            EntryActions.execute(context);

            NSFStateMachine parentStateMachine = ParentStateMachine;

            if (parentStateMachine != null)
            {
                parentStateMachine.executeStateChangeActions(context);
            }
        }
 /// <summary>
 /// Creates a state machine context.
 /// </summary>
 /// <param name="source">The state machine.</param>
 /// <param name="enteringState">The state being entered.</param>
 /// <param name="exitingState">The state being exited.</param>
 /// <param name="transition">The associated transition.</param>
 /// <param name="trigger">The triggering event.</param>
 public NSFStateMachineContext(NSFStateMachine source, NSFState enteringState, NSFState exitingState, NSFTransition transition, NSFEvent trigger)
     : base(source)
 {
     EnteringState = enteringState;
     ExitingState  = exitingState;
     Transition    = transition;
     Trigger       = trigger;
 }
コード例 #3
0
        /// <summary>
        /// Executes the actions in the state change actions list.
        /// </summary>
        internal void executeStateChangeActions(NSFStateMachineContext context)
        {
            StateChangeActions.execute(context);

            NSFStateMachine parentStateMachine = ParentStateMachine;

            if (parentStateMachine != null)
            {
                parentStateMachine.executeStateChangeActions(context);
            }
        }
コード例 #4
0
 /// <summary>
 /// Creates a state machine context.
 /// </summary>
 /// <param name="source">The state machine.</param>
 /// <param name="enteringState">The state being entered.</param>
 /// <param name="exitingState">The state being exited.</param>
 /// <param name="transition">The associated transition.</param>
 /// <param name="trigger">The triggering event.</param>
 public NSFStateMachineContext(NSFStateMachine source, NSFState enteringState, NSFState exitingState, NSFTransition transition, NSFEvent trigger)
     : base(source)
 {
     EnteringState = enteringState;
     ExitingState = exitingState;
     Transition = transition;
     Trigger = trigger;
 }