Ejemplo n.º 1
0
        /// <summary>
        /// Exits to the specified target state.
        /// </summary>
        /// <param name="transition">The firing transition.</param>
        /// <param name="eventArgs">
        /// The <see cref="StateEventArgs"/> instance containing the required data.
        /// </param>
        internal void ExitState(Transition transition, StateEventArgs eventArgs)
        {
            if (Count == 0 || ActiveState == null)
            {
                return; // Nothing to do.
            }
            // Call exit on current state. The method will call true if the
            // state was exited. If the ActiveState contains the target state,
            // the method will return false and the ActiveState will still be active.
            bool exited = ActiveState.ExitState(transition, eventArgs);

            if (exited)
            {
                ActiveState = null;
            }
        }