private void garageButton_Click(object sender, EventArgs e) { if (this.garageButton.BackColor != Color.Green) { GarageDoor garageDoor = new GarageDoor(); this.command = new GarageDoorUpCommand(garageDoor); setCommandAndPress(command); this.garageButton.BackColor = Color.Green; myStack.Push(command); } else if (this.garageButton.BackColor == Color.Green) { GarageDoor garageDoor = new GarageDoor(); this.command = new GarageDoorDownCommand(garageDoor); setCommandAndPress(command); this.garageButton.BackColor = Color.Red; myStack.Push(command); } }
public GarageDoorDownCommand(GarageDoor garageDoor) { this.garageDoor = garageDoor; }
public GarageDoorUpCommand(GarageDoor garageDoor) { this.garageDoor = garageDoor; }