public void UpdateConfiguration(GetConfigurationValuesResponse configuration) { TemperatureModulesW1 = ToString(configuration, TEMPERATURE_MODULES_W1); TemperatureModuleW1 = ToString(configuration, TEMPERATURE_MODULE_W1); SaunaOutputGpioPin = ToInt32(configuration, SAUNA_OUTPUT_GPIO_PIN); SaunaInputGpioPin = ToInt32(configuration, SAUNA_INPUT_GPIO_PIN); InfraredOutputGpioPin = ToInt32(configuration, INFRARED_OUTPUT_GPIO_PIN); InfraredInputGpioPin = ToInt32(configuration, INFRARED_INPUT_GPIO_PIN); SaunaHysteresis = ToInt32(configuration, SAUNA_HYSTERESIS); InfraredHysteresis = ToInt32(configuration, INFRARED_HYSTERESIS); SaunaDefaultDuration = ToInt32(configuration, SAUNA_DEFAULT_DURATION); InfraredDefaultDuration = ToInt32(configuration, INFRARED_DEFAULT_DURATION); SaunaDefaultTemperature = ToInt32(configuration, SAUNA_DEFAULT_TEMPERATURE); InfraredDefaultTemperature = ToInt32(configuration, INFRARED_DEFAULT_TEMPERATURE); }
private int ToInt32(GetConfigurationValuesResponse configuration, string configurationName) { return(Convert.ToInt32( configuration.ConfigurationValues.Single(x => x.Name == configurationName).Value)); }
private string ToString(GetConfigurationValuesResponse configuration, string configurationName) { return(configuration.ConfigurationValues.Single(x => x.Name == configurationName).Value); }