static void Main(string[] args) { Receiver r = new Receiver(); Command c = new Run1000Meter(r); Invoke i = new Invoke(c); i.ExecuteCommand(); Console.ReadKey(); }
static void Main(string[] args) { Receiver receiver = new Receiver(); Command command =new ConcreteCommand(receiver); Invoker invoke = new Invoker(); invoke.SetCommand(command); invoke.ExecuteCommand(); Console.ReadKey(); }
static void Main(string[] args) { Receiver r = new Receiver(); Command c = new ConcreteCommand(r); Invoker i = new Invoker(); // Set and execute command i.SetCommand(c); i.ExecuteCommand(); Console.Read(); }
public ConcreteCommand(Receiver receiver) : base(receiver) { }
public Command(Receiver receiver) { this.receiver = receiver; }
public ConcreteCommond(Receiver recv) : base(recv) { }
public Commond(Receiver recv) { this.receiver = recv; }
public override void Excute() { Receiver.Action("执行请求A"); }
public Run1000Meter(Receiver _receiver) : base(_receiver) { }
public Command(Receiver _receiver) { this.receiver = _receiver; }
public AbstractCommand(Receiver r) { this.receiver = r; }
public ConcreteCommond() { receiver = new Receiver(); }