//------------------------------------------------------------------------------------------------ //------------------------------------Week's Weather---------------------------------------------- //------------------------------------------------------------------------------------------------ public static void UpdateThisWeeksWeather() { //Read the new weather data then process it into WeeksWeather WeeksWeatherData weeksData = ReadThisWeeksWeatherInformation(); if (weeksData != null) { ProcessWeeksWeatherData(weeksData); } }
private static void ProcessWeeksWeatherData(WeeksWeatherData weeksData) { //Clear the weeks weather for new entries WeeksWeather.Clear(); //Iterate through the forecast items for the week and convert them to DaysWeatherForecasts //then store them into WeeksWeather for retrieval for displaying for (int i = 1; i < weeksData.cnt; i++) { DaysWeatherForecast weather = new DaysWeatherForecast(UnixTimeStampToDateTime(weeksData.list[i].dt)); weather.SetWeather(weeksData.list[i].weather[0].main); weather.SetWeatherIcon(weeksData.list[i].weather[0].icon); weather.SetHighTemperature(weeksData.list[i].temp.max); weather.SetLowTemperature(weeksData.list[i].temp.min); WeeksWeather.Add(weather); } }