private async void XFBtnResend_Clicked(object sender, EventArgs e) { if (!CrossConnectivity.Current.IsConnected) { await DisplayAlert("Network Error", "Server not responding", "OK"); } else { try { codeVerificationRequest.cellphone = Settings.PhoneNo; codeVerificationResponse = await _apiServices.ResendCodeAsync(new Get_API_Url().CommonBaseApi(_baseUrl), false, new HeaderModel(), codeVerificationRequest); var result = codeVerificationResponse; if (result != null) { await DisplayAlert("Success", "The validation code request has been resent", "OK"); //await Navigation.PushAsync(new RegisterScreenThird()); } else { await DisplayAlert("Message", "Server Error", "OK"); } } catch (Exception ex) { await DisplayAlert("Message", "You are not Authorized", "OK"); } } }
public LoginVerificationScreen() { InitializeComponent(); NavigationPage.SetHasNavigationBar(this, false); codeVerificationRequest = new CodeVerificationRequestModel(); codeVerificationResponse = new CodeVerificationResponseModel(); _apiServices = new RestApi(); _baseUrl = Domain.Url + Domain.CodeValidateApiConstant; BindingContext = codeVerificationRequest; XFLabelTxt1.Text = "Enter the 4 digit code sent to you at " + Settings.PhoneNo; }
private async void XFBtnContinue_Clicked(object sender, EventArgs e) { if (!CrossConnectivity.Current.IsConnected) { await DisplayAlert("Network Error", "Server not responding", "OK"); } else { if (string.IsNullOrEmpty(codeVerificationRequest.code)) { await DisplayAlert("Alert", "Please click on resend button", "OK"); } else { try { codeVerificationRequest.cellphone = Settings.PhoneNo; codeVerificationResponse = await _apiServices.ValidateCodeAsync(new Get_API_Url().CommonBaseApi(_baseUrl), false, new HeaderModel(), codeVerificationRequest); var result = codeVerificationResponse; if (result.status == "Valid") { //await DisplayAlert("Message", "The code is valid", "OK"); //await DisplayAlert("Message", "The driver has been successfully logged in", "OK"); Settings.IsLoggedIn = true; var otherPage = new HomePage(); var homePage = App.NavigationPage.Navigation.NavigationStack.First(); App.NavigationPage.Navigation.InsertPageBefore(otherPage, homePage); await App.NavigationPage.PopToRootAsync(false); } else { await DisplayAlert("Message", "Verification Code Error", "OK"); } } catch (Exception ex) { await DisplayAlert("Message", "You are not Authorized", "OK"); } } } }
private async void XFBtnContinue_Clicked(object sender, EventArgs e) { if (!CrossConnectivity.Current.IsConnected) { await DisplayAlert("Network Error", "Server not responding", "OK"); } else { if (string.IsNullOrEmpty(codeVerificationRequest.code)) { await DisplayAlert("Alert", "Please enter Verification Code.", "OK"); } else { try { codeVerificationRequest.cellphone = StaticHelper.CellPhone; codeVerificationResponse = await _apiServices.ValidateCodeAsync(new Get_API_Url().CommonBaseApi(_baseUrl), false, new HeaderModel(), codeVerificationRequest); var result = codeVerificationResponse; if (result.status == "Success") { await DisplayAlert("Message", "The driver has been successfully created", "OK"); await App.NavigationPage.Navigation.PushAsync(new RegisterScreenThird()); } else if (result.status == "Invalid") { await DisplayAlert("Message", "Code is not valid.", "OK"); } else { await DisplayAlert("Message", "Server Error", "OK"); } } catch (Exception ex) { await DisplayAlert("Message", "You are not Authorized", "OK"); } } } }