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 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)); }