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()); }
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(); }
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(); }