コード例 #1
0
 /// <summary>
 ///     Specify an action that will execute when transitioning into
 ///     the configured state.
 /// </summary>
 /// <typeparam name="TArg0">Type of the first trigger argument.</typeparam>
 /// <param name="entryAction">Action to execute, providing details of the transition.</param>
 /// <param name="trigger">The trigger by which the state must be entered in order for the action to execute.</param>
 /// <returns>The receiver.</returns>
 public StateConfiguration OnEntryFrom <TArg0>(TriggerWithParameters <TArg0> trigger,
                                               Action <TArg0, Transition> entryAction)
 {
     Enforce.ArgumentNotNull(entryAction, "entryAction");
     Enforce.ArgumentNotNull(trigger, "trigger");
     _representation.AddEntryAction(trigger.Trigger, (t, args) => entryAction(
                                        ParameterConversion.Unpack <TArg0>(args, 0), t));
     return(this);
 }
コード例 #2
0
 /// <summary>
 ///     Accept the specified trigger and transition to the destination state, calculated
 ///     dynamically by the supplied function.
 /// </summary>
 /// <param name="trigger">The accepted trigger.</param>
 /// <param name="destinationStateSelector">
 ///     Function to calculate the state
 ///     that the trigger will cause a transition to.
 /// </param>
 /// <param name="guard">
 ///     Function that must return true in order for the
 ///     trigger to be accepted.
 /// </param>
 /// <returns>The reciever.</returns>
 /// <typeparam name="TArg0">Type of the first trigger argument.</typeparam>
 public StateConfiguration PermitDynamicIf <TArg0>(TriggerWithParameters <TArg0> trigger,
                                                   Func <TArg0, TState> destinationStateSelector, Func <bool> guard)
 {
     Enforce.ArgumentNotNull(trigger, "trigger");
     Enforce.ArgumentNotNull(destinationStateSelector, "destinationStateSelector");
     return(InternalPermitDynamicIf(
                trigger.Trigger,
                args => destinationStateSelector(
                    ParameterConversion.Unpack <TArg0>(args, 0)),
                guard));
 }
コード例 #3
0
            /// <summary>
            ///     Ensure that the supplied arguments are compatible with those configured for this
            ///     trigger.
            /// </summary>
            /// <param name="args"></param>
            public void ValidateParameters(object[] args)
            {
                Enforce.ArgumentNotNull(args, "args");

                ParameterConversion.Validate(args, _argumentTypes);
            }