コード例 #1
0
ファイル: WeatherAPI.cs プロジェクト: mdelgert/openweathermap
        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);
        }
コード例 #2
0
ファイル: WeatherAPI.cs プロジェクト: mdelgert/openweathermap
 private static void TimerEvent(WeatherModel wm)
 {
     CheckWeatherMap(GetRequestUrl(wm));
     LogMessage($@"Next WeatherMap Call in {wm.Interval} milliseconds.");
 }
コード例 #3
0
ファイル: WeatherAPI.cs プロジェクト: mdelgert/openweathermap
        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);
        }