Example #1
0
        private async void DisplayForecastDetails()
        {
            Forecast forecast = await ForecastProcessor.GetForecast();

            int above20DegreeDays = ForecastProcessor.GetNumberOfDaysWithTempAbove(20, forecast);
            int sunnyDays         = ForecastProcessor.GetNumberOfWithWeatherCondition("Clear", forecast);

            WeatherMap.Text += "In next 5 days" + "\n";
            WeatherMap.Text += "--------------" + "\n";
            WeatherMap.Text += "The number of days have temperature above 20 degrees = " + above20DegreeDays + "\n";
            WeatherMap.Text += "The number of sunny days = " + sunnyDays + "\n";

            WeatherMap.Text += "\n N.B 'Clear' days are taken as 'Sunny' days.";
        }
Example #2
0
        /// <summary>
        /// This method is to display the forecast details.
        /// </summary>
        /// <returns></returns>
        private static async Task DisplayForecastDetails()
        {
            Forecast forecast = await ForecastProcessor.GetForecast(url);

            int above20DegreeDays = ForecastProcessor.GetNumberOfDaysWithTempAbove(20, forecast);
            int sunnyDays         = ForecastProcessor.GetNumberOfWithWeatherCondition("Clear", forecast);

            Console.WriteLine("In next 5 days");
            Console.WriteLine("--------------");
            Console.WriteLine("The number of days have temperature above 20 degrees = " + above20DegreeDays);
            Console.WriteLine("The number of sunny days = " + sunnyDays);

            Console.WriteLine("N.B 'Clear' days are taken as 'Sunny' days.");
            Console.WriteLine("Updated at " + DateTime.Now);
        }