Exemple #1
0
        static void Main()
        {
            Context context = new Context();

            StartState startState = new StartState(); startState.DoAction(context);

            Console.WriteLine(context.GetState().ToString());

            StopState stopState = new StopState(); stopState.DoAction(context);

            Console.WriteLine(context.GetState().ToString());
        }
Exemple #2
0
        public static void Demo()
        {
            Context    c  = new Context();
            StartState sa = new StartState();

            sa.DoAction(c);
            Console.WriteLine(c.State.ToString());
            StopState so = new StopState();

            so.DoAction(c);
            Console.WriteLine(c.State.ToString());
            Console.Read();
        }
Exemple #3
0
        static void Main(string[] args)
        {
            Context context = new Context();

            StartState startState = new StartState();

            startState.DoAction(context);

            Console.WriteLine(context.State.ToString());

            StopState stopState = new StopState();

            stopState.DoAction(context);

            Console.WriteLine(context.State.ToString());

            Console.ReadKey();
        }