Beispiel #1
0
        private async void ExecuteLoadDataCommand(object obj)
        {
            IsBusy = true;
            try
            {
                Cars.Clear();

                var task1 = CarsService.GetCarsAsync();
                var task2 = PlacesService.GetPlacesAsync();
                foreach (var car in await task1)
                {
                    Cars.Add(car);
                }
                foreach (var place in await task2)
                {
                    if (!place.occupied)
                    {
                        Places.Add(place);
                    }
                }
            }
            catch (Exception ex)
            {
                Debug.WriteLine(ex);
                await Application.Current.MainPage.DisplayAlert("BŁĄD", "Nie udało się wczytać samochodów", "ANULUJ");
            }
            finally
            {
                IsBusy = false;
            }
        }
 private async void SearchTextAsync(string text)
 {
     Places         = new ObservableCollection <Place>(await PlacesService.GetPlacesAsync(text));
     IsLableVisible = Places.Count == 0;
 }