using GMCabsDriverAssistant.Models;
|
|
using GMCabsDriverAssistantSolution.ViewModels;
|
|
|
|
namespace GMCabsDriverAssistantSolution.Views;
|
|
|
|
public partial class AcceptBookingPage : ContentPage
|
|
{
|
|
#region Fields
|
|
[Obsolete]
|
|
private readonly AcceptBookingViewModel _viewModel;
|
|
#endregion
|
|
[Obsolete]
|
|
public AcceptBookingPage()
|
|
{
|
|
BindingContext = _viewModel = new AcceptBookingViewModel();
|
|
InitializeComponent();
|
|
}
|
|
|
|
[Obsolete]
|
|
protected override bool OnBackButtonPressed()
|
|
{
|
|
NavigateToHomePage(false);
|
|
base.OnBackButtonPressed();
|
|
return true;
|
|
}
|
|
|
|
[Obsolete]
|
|
protected override void OnDisappearing()
|
|
{
|
|
NavigateToHomePage(false);
|
|
base.OnDisappearing();
|
|
}
|
|
|
|
[Obsolete]
|
|
private void OnAcceptOkClicked(object sender, EventArgs e)
|
|
{
|
|
NavigateToHomePage(true);
|
|
}
|
|
|
|
[Obsolete]
|
|
private async void NavigateToHomePage(bool isOkPressed)
|
|
{
|
|
AcceptBookingTimerDto acceptBookingTimerDto = new AcceptBookingTimerDto();
|
|
|
|
if (!_viewModel.isFutureBooking)
|
|
{
|
|
acceptBookingTimerDto.PendingSeconds = _viewModel.seconds;
|
|
acceptBookingTimerDto.PickUPAddress = _viewModel.pickUpAddress;
|
|
acceptBookingTimerDto.DropUpAddress = _viewModel.dropUpAddress;
|
|
}
|
|
else
|
|
{
|
|
acceptBookingTimerDto.PendingSeconds = 0;
|
|
acceptBookingTimerDto.PickUPAddress = string.Empty;
|
|
acceptBookingTimerDto.DropUpAddress = string.Empty;
|
|
}
|
|
|
|
if (!_viewModel.isBookingUnavailable && !isOkPressed)
|
|
{
|
|
MessagingCenter.Send(this, nameof(AcceptBookingPage), acceptBookingTimerDto);
|
|
}
|
|
|
|
await Shell.Current.GoToAsync($"//{nameof(HomePage)}");
|
|
|
|
}
|
|
private async void OnUnavailableOkClicked(object sender, EventArgs e)
|
|
{
|
|
await Navigation.PushAsync(new BookingsPage(null, null));
|
|
}
|
|
}
|