private async void RefreshCinemas() { try { cinemasListView.IsRefreshing = true; var position = await GeoLocation.GetCurrentLocation(); var cinemas = await Service.GetCinemas(position.Latitude, position.Longitude, (int)Slider.Value); CinemaList = new ObservableCollection <Cinema>(cinemas.Where(c => c.Name != null)); cinemasListView.ItemsSource = CinemaList; } catch (GeolocationException E) { await DisplayAlert("Error", "Please enable the location service.", "Exit"); AppControls.CloseApp(); } catch (TaskCanceledException E) { await DisplayAlert("Oops..!!", "Unable to find your location. Please try again.", "Ok"); } catch (Exception E) { await DisplayAlert("Error", $"{E} - {E.Message}", "Exit"); AppControls.CloseApp(); } finally { cinemasListView.IsRefreshing = false; } }
private async void OnLoad() { try { showtimesListView.IsRefreshing = true; var showtimes = await Service.GetShowtimes(Cinema.Id, Movie.Id); var data = showtimes.ToArray(); Array.Sort(data, new ShowtimeComparer()); ShowtimesList = new ObservableCollection <Showtime>(data); showtimesListView.ItemsSource = ShowtimesList; } catch (Exception E) { await DisplayAlert("Error", $"{E} - {E.Message}", "Exit"); AppControls.CloseApp(); } finally { showtimesListView.IsRefreshing = false; } }
private async void OnLoad() { try { moviesListView.IsRefreshing = true; var movies = await Service.GetMoviesByCinemaId(Cinema.Id); MovieList = new ObservableCollection <Movie>(movies.Where(m => m.Title != null)); moviesListView.ItemsSource = MovieList; } catch (Exception E) { await DisplayAlert("Error", $"{E} - {E.Message}", "Exit"); AppControls.CloseApp(); } finally { moviesListView.IsRefreshing = false; } }