Example #1
0
 public CityWeather(OpenWeatherMapService.ForecastInfo forecast, int index)
 {
     OpenWeatherMapService.CityForecastWeatherInfo info = forecast.list[index];
     OpenWeatherMapService.CityInfo cityInfo            = forecast.city;
     this.cityWeatherInfo = new OpenWeatherMapService.CityCurrentWeatherInfo()
     {
         clouds = info.clouds, dt = info.dt, main = info.main, weather = info.weather, wind = info.wind, coord = cityInfo.coord, id = cityInfo.id, name = cityInfo.name
     };
     this.weather             = new Weather(cityWeatherInfo.main);
     this.weatherDescriptions = new List <WeatherDescription>();
     foreach (OpenWeatherMapService.WeatherDescriptionInfo weatherDescription in cityWeatherInfo.weather)
     {
         weatherDescriptions.Add(new WeatherDescription(weatherDescription));
     }
 }
Example #2
0
        internal void SetForecast(OpenWeatherMapService.ForecastInfo forecast)
        {
            if (forecast == null)
            {
                return;
            }
            List <CityWeather> cityWeatherList = new List <CityWeather>();

            for (int i = 0; i < forecast.list.Count; i++)
            {
                cityWeatherList.Add(new CityWeather(forecast, i));
            }

            this.forecast = cityWeatherList;
            if (ForecastUpdated != null)
            {
                ForecastUpdated(this, EventArgs.Empty);
            }
        }