Пример #1
0
        /// <summary>
        /// Ignore a particular event. Firing the event will succeed, but no transition will occur
        /// </summary>
        /// <typeparam name="TEventData">Type of event data</typeparam>
        /// <param name="event">Event to ignore</param>
        public TState Ignore <TEventData>(Event <TEventData> @event)
        {
            if (@event == null)
            {
                throw new ArgumentNullException(nameof(@event));
            }

            var transition = new IgnoredTransition <TState, TEventData>(this.self, @event, this.ParentStateMachine.TopmostStateMachineInternal);

            @event.AddTransition(this, transition, this.ParentStateMachine.TopmostStateMachineInternal);
            return(this.self);
        }
Пример #2
0
        public Transition <TState, TEventData> InnerSelfTransitionOn <TEventData>(TState fromAndToState, Event <TEventData> @event)
        {
            if (@event == null)
            {
                throw new ArgumentNullException(nameof(@event));
            }

            var transition = Transition.CreateInner <TState, TEventData>(fromAndToState, @event, this.transitionDelegate);

            @event.AddTransition(fromAndToState, transition);
            this.AddTransition(transition);
            return(transition);
        }
Пример #3
0
        /// <summary>
        /// Create an inner self transition, i.e. a transition back to this state which will not call this state's exit/entry handlers
        /// </summary>
        /// <param name="event">Event which will trigger this transition</param>
        /// <returns>The created transition, to which handlers can be addeds</returns>
        public Transition <TState, TEventData> InnerSelfTransitionOn <TEventData>(Event <TEventData> @event)
        {
            this.CheckInitialized();
            if (@event == null)
            {
                throw new ArgumentNullException(nameof(@event));
            }

            var transition = new Transition <TState, TEventData>(this.self, @event, this.ParentStateMachine.TopmostStateMachineInternal);

            @event.AddTransition(this, transition, this.ParentStateMachine.TopmostStateMachineInternal);
            this.transitions.Add(transition);
            return(transition);
        }