コード例 #1
0
        public void addWeatherForecastResponse(Coordinates coord, List <IDayWeather> response)
        {
            var key = coord.ToString();

            this.WeatherForecastHistory.Remove(key);
            var val = new OwmApiWeatherForecastResponse();

            val.Date  = DateTime.Now;
            val.Value = response;
            this.WeatherForecastHistory.Add(key, val);
        }
コード例 #2
0
        public List <IDayWeather> getWeatherForecastResponse(Coordinates coord)
        {
            var key = coord.ToString();
            OwmApiWeatherForecastResponse val = null;

            if (this.WeatherForecastHistory.TryGetValue(key, out val))
            {
                var now = DateTime.Now;
                if (now.Subtract(val.Date).TotalMinutes <= 10)
                {
                    return(val.Value);
                }
            }
            return(null);
        }