private bool TryParseWeatherData(string source) { try { var parser = new OpenWeatherMapResponseParser(); parser.Parse(source); _systemInformationService.Set($"{nameof(OpenWeatherMapService)}/LastConditionCode", parser.ConditionCode); _systemInformationService.Set($"{nameof(OpenWeatherMapService)}/LastCondition", parser.Condition.ToString); _systemInformationService.Set($"{nameof(OpenWeatherMapService)}/LastTemperature", parser.Temperature); _systemInformationService.Set($"{nameof(OpenWeatherMapService)}/LastHumidity", parser.Humidity); _systemInformationService.Set($"{nameof(OpenWeatherMapService)}/LastSunrise", parser.Sunrise); _systemInformationService.Set($"{nameof(OpenWeatherMapService)}/LastSunset", parser.Sunset); Condition = parser.Condition; Temperature = parser.Temperature; Humidity = parser.Humidity; Sunrise = parser.Sunrise; Sunset = parser.Sunset; return(true); } catch (Exception exception) { _log.Warning(exception, $"Error while parsing Open Weather Map response ({source})."); return(false); } }
private void ParseWeatherData(string weatherData) { var parser = new OpenWeatherMapResponseParser(); parser.Parse(weatherData); _weatherService.Update(parser.Situation); _outdoorTemperatureService.Update(parser.Temperature); _outdoorHumdityService.Update(parser.Humidity); _daylightService.Update(parser.Sunrise, parser.Sunset); }
private void ParseWeatherData(string weatherData) { var parser = new OpenWeatherMapResponseParser(); parser.Parse(weatherData); _situation = parser.Situation; _temperature = parser.Temperature; _humidity = parser.Humidity; _sunrise = parser.Sunrise; _sunset = parser.Sunset; }
private bool TryParseData(string weatherData) { try { var parser = new OpenWeatherMapResponseParser(); parser.Parse(weatherData); Weather = parser.Weather; Temperature = parser.Temperature; Humidity = parser.Humidity; Sunrise = parser.Sunrise; Sunset = parser.Sunset; return(true); } catch (Exception exception) { Log.Warning(exception, $"Error while parsing Open Weather Map response ({weatherData})."); return(false); } }
private bool TryParseData(string weatherData) { try { var parser = new OpenWeatherMapResponseParser(); parser.Parse(weatherData); Weather = parser.Weather; Temperature = parser.Temperature; Humidity = parser.Humidity; Sunrise = parser.Sunrise; Sunset = parser.Sunset; return true; } catch (Exception exception) { Log.Warning(exception, $"Error while parsing Open Weather Map response ({weatherData})."); return false; } }