Exemplo n.º 1
0
    /// <summary>
    /// Entry point into console application.
    /// </summary>
    static void Main()
    {
      // Setup context in a state
      Context c = new Context(new ConcreteStateA());
 
      // Issue requests, which toggles state
      c.Request();
      c.Request();
      c.Request();
      c.Request();
 
      // Wait for user
      Console.ReadKey();
    }
Exemplo n.º 2
0
 public override void Handle(Context context)
 {
   context.State = new ConcreteStateA();
 }
Exemplo n.º 3
0
 public abstract void Handle(Context context);