private void button11_Click(object sender, EventArgs e) { richTextBox1.Text = null; foreach (var buf in label) { if (buf.BackColor != Color.MediumTurquoise) { buf.BackColor = Color.MediumTurquoise; } } label11.BackColor = Color.MediumSeaGreen; if (label11.BackColor == Color.MediumSeaGreen & flag == true) { RemoteControl remoteControl = new RemoteControl(); Ceilinglight ceilinglight = new Ceilinglight(richTextBox1); CeilinglightOnCommands ceilinglightOnCommand = new CeilinglightOnCommands(ceilinglight); CeilinglightOffCommands ceilinglightOffCommand = new CeilinglightOffCommands(ceilinglight); remoteControl.SetCommand(3, ceilinglightOnCommand, ceilinglightOffCommand); remoteControl.OffButtonWasPushed(3); flag = false; } else { richTextBox1.Text = null; richTextBox1.Text = "Ceiling light is Off\nPress key On Ceiling light"; } }
public CeilinglightOffCommands(Ceilinglight ceilinglight) { this.ceilinglight = ceilinglight; }