// Constructor public Command(Receiver receiver) { this.receiver = receiver; }
// Constructor public ConcreteCommand(Receiver receiver) : base(receiver) { }
private void btnCommand_Click(object sender, EventArgs e) { Receiver receiver = new Receiver(); Command command = new ConcreteCommand(receiver); Invoker invoker = new Invoker(); // Set and execute command invoker.SetCommand(command); invoker.ExecuteCommand(); }