Exemple #1
0
        public async void GetWeather()
        {
            if (selectedCity.Equals(null) || string.IsNullOrEmpty(selectedCity.Key))
            {
                return;
            }
            var weather = await WeatherApi.GetWeatherInformation(selectedCity.Key);

            DailyForecasts.Clear();
            foreach (DailyForecast forecast in weather.DailyForecasts)
            {
                DailyForecasts.Add(forecast);
            }
        }
Exemple #2
0
        private async void GetCities()
        {
            Cities.Clear();
            List <City> cities = await WeatherApi.GetAutoComplete(Query);

            if (cities is null)
            {
                return;
            }
            foreach (City city in cities)
            {
                Cities.Add(city);
            }
        }