예제 #1
0
        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.ToString("D"),
                EndDate   = DateTime.Today.AddDays(5).ToString("D")
            };

            //Iterate through all weather data retrieved and create BasicWeather objects
            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
                if (ValidTimeToday(date))
                {
                    WeatherWeekDay weather = new WeatherWeekDay()
                    {
                        HighTemperature = daysData.list[i].temp.max,
                        LowTemperature  = daysData.list[i].temp.min,
                        IconId          = daysData.list[i].weather[0].icon,
                        WeatherType     = daysData.list[i].weather[0].main,
                    };
                    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,
                WeatherType     = weatherType,
                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;
 }