Esempio n. 1
0
        public void addCurrentWeatherResponse(Coordinates coord, IDayWeather response)
        {
            var key = coord.ToString();

            this.CurrentWeatherHistory.Remove(key);
            var val = new OwmApiCurrentWeatherResponse();

            val.Date  = DateTime.Now;
            val.Value = response;
            this.CurrentWeatherHistory.Add(key, val);
        }
Esempio n. 2
0
        public IDayWeather getCurrentWeatherResponse(Coordinates coord)
        {
            var key = coord.ToString();
            OwmApiCurrentWeatherResponse val = null;

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