Exemple #1
0
 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);
     }
 }
Exemple #2
0
 public GarageDoorDownCommand(GarageDoor garageDoor)
 {
     this.garageDoor = garageDoor;
 }
 public GarageDoorUpCommand(GarageDoor garageDoor)
 {
     this.garageDoor = garageDoor;
 }