Example #1
0
        /// <summary>
        ///     The state test.
        /// </summary>
        public static void StateTest()
        {
            var stateContext = new StateContext(new ConcreteState1());

            stateContext.Request();
            stateContext.Request();
            stateContext.Request();
            stateContext.Request();
            Console.WriteLine("StateTest finish.");
        }
Example #2
0
        public void Test()
        {
            var context = new StateContext <StateTypeA>(new OpenState(), new InputA {
                Name = "Jacky"
            });

            context.Request();
            context.Request();
            context.Request();
        }
Example #3
0
 /// <summary>
 /// The handle.
 /// </summary>
 /// <param name="context">
 /// The context.
 /// </param>
 public abstract void Handle(StateContext context);
Example #4
0
 /// <summary>
 /// The handle.
 /// </summary>
 /// <param name="context">
 /// The context.
 /// </param>
 public override void Handle(StateContext context)
 {
     context.State = new ConcreteState1();
 }