private void ResponseEngine_HandleConfigurationParsedEvent(int temperatureText, int humidityText, bool isFanOn, bool isLightOn, int R, int G, int B) { ResponseEngine_HandleTempertureEvent(temperatureText); ResponseEngine_HandleHumidityEvent(humidityText); FanButton.SetBackgroundColor(BackgroundConverter.GetFromBool(isFanOn)); LightButton.SetBackgroundColor(BackgroundConverter.GetFromBool(isLightOn)); ColorDialogButton.SetBackgroundColor(new Color(R, G, B)); }
private void OnColorSelected(int color) { Message message; Color = new Color(color); message = new Message(Color.R, Color.G, Color.B); message.Create(); communicationService.Write(message.RawBytes); ColorDialogButton.SetBackgroundColor(this.Color); if (!isLightOn) { isLightOn = true; } LightButton.SetBackgroundColor(BackgroundConverter.GetFromBool(isLightOn)); }
private void FanButton_Click(object sender, EventArgs e) { Message message; if (isFanOn) { message = new Message((byte)CommandCode.FanOff); message.Create(); isFanOn = false; } else { message = new Message((byte)CommandCode.FanOn); message.Create(); isFanOn = true; } communicationService.Write(message.RawBytes); FanButton.SetBackgroundColor(BackgroundConverter.GetFromBool(isFanOn)); }
private void ButtonLightCommand_Click(object sender, System.EventArgs e) { Message message; if (isLightOn == false) { message = new Message((byte)CommandCode.LightOn, Color.R, Color.G, Color.B); message.Create(); isLightOn = true; } else { message = new Message((byte)CommandCode.LightOff); message.Create(); isLightOn = false; } communicationService.Write(message.RawBytes); LightButton.SetBackgroundColor(BackgroundConverter.GetFromBool(isLightOn)); }