Esempio n. 1
0
        public static void RunSimpleStateMachineSample()
        {
            var initialState  = new State(42, 1337);
            var initialAction = new TaskC();

            var transitions = new Dictionary <StateId, IStatefulTask <State, StateId> >
            {
                { StateId.StateA, new TaskA() },
                { StateId.StateB, new TaskB() },
                { StateId.StateC, new TaskC() },
                { StateId.Final, FinalStatefulTask <State> .Create(StateId.Final) }
            };

            Logger.Message($"Initial state: {initialState}");
            Logger.Message("Starting performing.");
            State finalState = StateMachineHelper.PerformStraightforward(
                initialState, initialAction, transitions
                );

            Logger.Message($"Final state: '{finalState}'.");

            Logger.SkipLine();
            var initialAction2 = new TaskA();

            Logger.Message($"Initial state: {initialState}");
            Logger.Message("Starting performing.");
            State finalState2 = StateMachineHelper.PerformStraightforward(
                initialState, initialAction2, transitions
                );

            Logger.Message($"Final state: '{finalState2}'.");
        }
        public static void RunSimpleStateMachineSample()
        {
            var initialState  = new State(42, 1337);
            var initialAction = new TaskC();

            State finalState = StateMachineHelper.PerformStraightforward(
                initialState, initialAction
                );

            Logger.SkipLine();
            var initialAction2 = new TaskA();

            State finalState2 = StateMachineHelper.PerformStraightforward(
                initialState, initialAction2
                );
        }
Esempio n. 3
0
        public static void RunSimpleStateMachineSample()
        {
            var initialState  = new State(42, 1337);
            var initialAction = new TaskC();

            Logger.Message($"Initial state: {initialState}");
            Logger.Message("Starting performing.");
            State finalState = StateMachineHelper.PerformStraightforward(
                initialState, initialAction
                );

            Logger.Message($"Final state: {finalState}");

            Logger.SkipLine();
            var initialAction2 = new TaskA();

            Logger.Message($"Initial state: {initialState}");
            Logger.Message("Starting performing.");
            State finalState2 = StateMachineHelper.PerformStraightforward(
                initialState, initialAction2
                );

            Logger.Message($"Final state: {finalState2}");
        }