private async void MakeBookingAsync(object obj)
        {
            IsBusy = true;

            try
            {
                Booking booking = await _ridesService.RequestBikeBooking(FromStation, ToStation);

                MessagingCenter.Send(booking, MessengerKeys.BookingRequested);

                var navParameter = new BookingViewModel.BookingViewModelNavigationParameter
                {
                    ShowThanks = true,
                    BookingId  = booking.Id
                };

                await NavigationService.NavigateToAsync <BookingViewModel>(navParameter);

                await NavigationService.RemoveLastFromBackStackAsync();
            }
            catch (Exception ex) when(ex is WebException || ex is HttpRequestException)
            {
                await DialogService.ShowAlertAsync("Communication error", "Error", "Ok");
            }
            catch (Exception ex)
            {
                Debug.WriteLine($"Error loading data in: {ex}");
            }

            IsBusy = false;
        }
Exemple #2
0
        private async void OnSelectItem(MenuItem item)
        {
            if (item.IsEnabled)
            {
                object parameter = null;

                if (item.MenuItemType == MenuItemType.UpcomingRide)
                {
                    parameter = new BookingViewModel.BookingViewModelNavigationParameter
                    {
                        ShowThanks = false,
                        BookingId  = Settings.CurrentBookingId
                    };
                }

                await NavigationService.NavigateToAsync(item.ViewModelType, parameter);
            }
        }