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 } }