Пример #1
0
        //TODO this doesn't seem to update right at midnight, it will still retrieve yesterdays info for a while
        //We will need to fetch 7 days and perform a check to ensure we are getting between tomorrow and the 5th day.
        private static WeatherWeek ProcessWeeksWeatherData(WeeksWeatherData daysData)
        {
            WeatherWeek week = new WeatherWeek(DateTime.Now)
            {
                //Store tomorrow's date as 'long date' format: "Thursday, 10 April 2008"
                StartDate = DateTime.Today.AddDays(1),
                EndDate   = DateTime.Today.AddDays(5)
            };

            //Iterate through all weather data retrieved, starting at 1 because it includes today
            //and create WeatherHour objects for each
            for (int i = 1; i < daysData.cnt; i++)
            {
                DateTime date = UnixTimeStampToDateTime(daysData.list[i].dt);
                //If the current result is for today, process it and store it in today
                WeatherWeekDay weather = new WeatherWeekDay()
                {
                    HighTemperature = daysData.list[i].temp.max,
                    LowTemperature  = daysData.list[i].temp.min,
                    Date            = date,
                    IconId          = daysData.list[i].weather[0].icon,
                };
                week.AddDay(weather);
            }
            return(week);
        }
Пример #2
0
        public void InsertDay(int day, int high, int low, string weatherType, string iconID)
        {
            WeatherWeekDay dayOfWeek = new WeatherWeekDay()
            {
                HighTemperature = high,
                LowTemperature  = low,
                IconId          = iconID
            };

            WeatherDays[day] = dayOfWeek;
        }
Пример #3
0
 public void AddDay(WeatherWeekDay day)
 {
     WeatherDays.Add(day);
 }
Пример #4
0
 public void InsertDay(int day, WeatherWeekDay dayOfWeek)
 {
     WeatherDays[day] = dayOfWeek;
 }