Exemple #1
0
        private async Task RefreshLocationWeatherList()
        {
            LocationWeatherList.Clear();
            var locationList = _locationSearchServiceService.GetLocationList();

            foreach (var location in locationList)
            {
                var weatherList = await _weatherService.GetCurrentWeatherByLocationAsync(location.Key);

                var locationWeather = new LocationWeather
                {
                    Location       = location,
                    CurrentWeather = weatherList.FirstOrDefault()
                };

                LocationWeatherList.Add(locationWeather);
            }
        }
        async Task ExecuteLoadLocationListFromDataStoreCommandAsync()
        {
            await ExecuteCommandAsync(async() =>
            {
                LocationWeatherList.Clear();
                var locationList = await _locationSearchServiceService.GetItemListAsync(true);
                foreach (var location in locationList)
                {
                    var weatherList     = await _weatherService.GetCurrentWeatherByLocationAsync(location.Key);
                    var locationWeather = new LocationWeather
                    {
                        Location       = location,
                        CurrentWeather = weatherList.FirstOrDefault()
                    };

                    LocationWeatherList.Add(locationWeather);
                }
            });
        }