Browse Source

Implementation of Cancelled Booking Page and Its View Model

master
Kaustav Chaudhuri 1 year ago
parent
commit
231c3c5fe0
3 changed files with 139 additions and 0 deletions
  1. +45
    -0
      GMCabsDriverAssistantSolution/ViewModels/CancelledBookingViewModel.cs
  2. +53
    -0
      GMCabsDriverAssistantSolution/Views/CancelledBookingPage.xaml
  3. +41
    -0
      GMCabsDriverAssistantSolution/Views/CancelledBookingPage.xaml.cs

+ 45
- 0
GMCabsDriverAssistantSolution/ViewModels/CancelledBookingViewModel.cs View File

@ -0,0 +1,45 @@
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
namespace GMCabsDriverAssistantSolution.ViewModels
{
class CancelledBookingViewModel : BaseViewModel
{
#region Fields
public string pickUpAddress = "";
public string dropUpAddress = "";
#endregion
#region Properties
public string PickUpAddress
{
get => pickUpAddress;
set
{
SetProperty(ref pickUpAddress, value);
}
}
public string DropUpAddress
{
get => dropUpAddress;
set
{
SetProperty(ref dropUpAddress, value);
}
}
#endregion
#region Constructor
public CancelledBookingViewModel()
{
Title = "Booking Cancelled";
}
#endregion
#region Methods
#endregion
}
}

+ 53
- 0
GMCabsDriverAssistantSolution/Views/CancelledBookingPage.xaml View File

@ -0,0 +1,53 @@
<?xml version="1.0" encoding="utf-8" ?>
<ContentPage xmlns="http://schemas.microsoft.com/dotnet/2021/maui"
xmlns:x="http://schemas.microsoft.com/winfx/2009/xaml"
x:Class="GMCabsDriverAssistantSolution.Views.CancelledBookingPage"
Title="{Binding Title}">
<ContentPage.Content>
<StackLayout BackgroundColor="#DCDCDC">
<Label
Text="Booking Cancelled"
TextColor="Black"
FontSize="26"
Margin="0,90,0,0"
HorizontalTextAlignment="Center"
HorizontalOptions="CenterAndExpand" />
<Label
Text="{Binding PickUpAddress, StringFormat='{0} to'}"
TextColor="Black"
FontSize="26"
Margin="0,20,0,0"
FontAttributes="Bold"
HorizontalTextAlignment="Center"
HorizontalOptions="CenterAndExpand" />
<Label
Text="{Binding DropUpAddress}"
TextColor="Black"
FontSize="26"
FontAttributes="Bold"
HorizontalTextAlignment="Center"
HorizontalOptions="CenterAndExpand"/>
<Label
Text="This booking has been cancelled."
TextColor="Black"
Padding="20"
FontSize="24"
HorizontalTextAlignment="Center"
HorizontalOptions="CenterAndExpand"/>
<Label
Text="Please do not drive to the pickup location"
TextColor="Black"
FontSize="24"
Padding="20"
HorizontalTextAlignment="Center"
HorizontalOptions="CenterAndExpand" />
<Button
Margin="40,20,40,30"
Text="OK"
Clicked="OnCancelledOkClicked"
FontSize="20"
VerticalOptions="EndAndExpand"/>
</StackLayout>
</ContentPage.Content>
</ContentPage>

+ 41
- 0
GMCabsDriverAssistantSolution/Views/CancelledBookingPage.xaml.cs View File

@ -0,0 +1,41 @@
using GMCabsDriverAssistantSolution.ViewModels;
namespace GMCabsDriverAssistantSolution.Views;
public partial class CancelledBookingPage : ContentPage
{
#region Fields
private readonly CancelledBookingViewModel _viewModel;
#endregion
#region Properties
#endregion
#region Constructor
public CancelledBookingPage()
{
BindingContext = _viewModel = new CancelledBookingViewModel();
InitializeComponent();
}
#endregion
public void OnCancelledOkClicked(object sender, EventArgs e)
{
NavigateToHomePage();
}
protected override bool OnBackButtonPressed()
{
NavigateToHomePage();
base.OnBackButtonPressed();
return true;
}
protected override void OnDisappearing()
{
NavigateToHomePage();
base.OnDisappearing();
}
private async void NavigateToHomePage()
{
await Shell.Current.GoToAsync("..");
}
}

Loading…
Cancel
Save