Esempio n. 1
0
        // ==================================================================
        //Utility methods

        private string[] TableFiller(FiveDayWeather a, int day1, int day2)
        {
            List <string> values = new List <string>();

            values.Add(DateTime.Parse(a.list[day1].dt_txt).DayOfWeek + ", " + DateTime.Parse(a.list[day1].dt_txt).ToShortDateString());
            for (int i = day1; i < day2; i++)
            {
                values.Add(a.list[i].weather[0].main + ", " + String.Format("{0:0.0}", a.list[i].main.temp) + "°C");
            }
            return(values.ToArray());
        }
Esempio n. 2
0
        public void PrintFiveDayWeather(FiveDayWeather a)
        {
            int day1 = 0;
            int day2 = 8;
            int day3 = 16;
            int day4 = 24;
            int day5 = 32;
            int day6 = 40;

            //TODO: play more with output, exclude output for times < current time.

            var table = new ConsoleTable(a.city.name + ", " + a.city.country, "00:00", "03:00", "06:00", "09:00", "12:00", "15:00", "18:00", "21:00");

            table.AddRow(TableFiller(a, day1, day2));
            table.AddRow(TableFiller(a, day2, day3));
            table.AddRow(TableFiller(a, day3, day4));
            table.AddRow(TableFiller(a, day4, day5));
            table.AddRow(TableFiller(a, day5, day6));
            table.Write();
        }