Beispiel #1
0
        public static void ShowDemo()
        {
            Console.WriteLine("===== 基本的 状态模式 体系结构演示 =====");

            Context context = new Context(new ConcreteStateA());

            context.Request();

            context.Request();

            context.Request();
        }
 public override void Handle(Context context)
 {
     //设置状态A的下一状态是状态B
     context.State = new ConcreteStateB();
 }
 public override void Handle(Context context)
 {
     // 状态B的下一状态是状态C
     context.State = new ConcreteStateC();
 }
Beispiel #4
0
 public abstract void Handle(Context context);