private static WeatherModel GetModel() { var wm = new WeatherModel { ApiKey = GetKeyValue("ApiKey"), Url = GetKeyValue("Url"), CountryCode = GetKeyValue("CountryCode"), ZipCode = int.Parse(GetKeyValue("ZipCode")), Units = GetKeyValue("Units"), Mode = GetKeyValue("Mode"), Interval = int.Parse(GetKeyValue("Interval")) }; return(wm); }
private static void TimerEvent(WeatherModel wm) { CheckWeatherMap(GetRequestUrl(wm)); LogMessage($@"Next WeatherMap Call in {wm.Interval} milliseconds."); }
private static string GetRequestUrl(WeatherModel wm) { var requestUrl = $@"http://{wm.Url}?mode={wm.Mode}&units={wm.Units}&zip={wm.ZipCode},{wm.CountryCode}&appid={wm.ApiKey}"; return(requestUrl); }