You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
 

85 lines
2.5 KiB

using GMCabsDriverAssistant.Services;
using GMCabsDriverAssistantSolution.Views;
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
namespace GMCabsDriverAssistantSolution.ViewModels
{
class AdminPasswordViewModel : BaseViewModel
{
#region Fields
private string adminPassword;
private string message;
#endregion
#region Properties
public Command ContinueCommand { get; }
public Command BackCommand { get; }
public string AdminPassword
{
get => adminPassword;
set
{
SetProperty(ref adminPassword, value);
ErrorMessage = string.Empty;
}
}
public string ErrorMessage
{
get => message;
set => SetProperty(ref message, value);
}
#endregion
#region Constructor
public AdminPasswordViewModel()
{
ContinueCommand = new Command(OnContinueClicked);
BackCommand = new Command(OnBackClicked);
}
#endregion
#region Methods
[Obsolete]
private async void OnContinueClicked(object obj)
{
IsBusy = true;
ErrorMessage = "";
GMCabsDriverService gmCabsDriverService = new GMCabsDriverService();
if (string.IsNullOrWhiteSpace(AdminPassword))
{
IsBusy = false;
ErrorMessage = "Admin Password required";
return;
}
var isValid = await gmCabsDriverService.ValidateAdminPassword(AdminPassword);
if (isValid)
{
IsBusy = false;
if (Device.RuntimePlatform == Device.Android && Device.Idiom == TargetIdiom.Tablet)
{
await Shell.Current.GoToAsync($"//{nameof(LoginPage)}/{nameof(AdminPasswordPage)}/{nameof(ImeiNumberInstallPage)}");
}
else
{
await Shell.Current.GoToAsync($"//{nameof(LoginPage)}/{nameof(AdminPasswordPage)}/{nameof(TaxiInstallPage)}");
}
}
else
{
IsBusy = false;
ErrorMessage = "Password is not match";
}
}
private async void OnBackClicked(object obj)
{
ErrorMessage = "";
await Shell.Current.GoToAsync("..");
}
#endregion
}
}