Exemple #1
0
        /// <summary>
        /// Gets the current Weather status
        /// </summary>
        /// <returns>The current weather data</returns>
        public WeatherData CheckWeather()
        {
            WeatherData weather = null;

            try
            {
                WeatherApi dataApi = new WeatherApi(City + "," + Country, ApiKey, true);//gets current weather instead of 5 days forecast

                weather = dataApi.GetWeather();
            }
            catch (Exception e)
            {
                throw e;
            }

            return(weather);
        }
Exemple #2
0
        /// <summary>
        /// Gets a five days forecast
        /// </summary>
        /// <returns>The forecast for the next five days</returns>
        public Forecast CheckForecast()
        {
            Forecast forecast = null;

            try
            {
                WeatherApi dataApi = new WeatherApi(City + "," + Country, ApiKey);

                forecast = dataApi.GetForecast();
            }
            catch (Exception e)
            {
                throw e;
            }

            return(forecast);
        }