Exemplo n.º 1
0
        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);
        }
Exemplo n.º 2
0
 private static void TimerEvent(WeatherModel wm)
 {
     CheckWeatherMap(GetRequestUrl(wm));
     LogMessage($@"Next WeatherMap Call in {wm.Interval} milliseconds.");
 }
Exemplo n.º 3
0
        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);
        }