private async Task ConfirmEmailAsync(string userId, string s) { try { if (string.IsNullOrWhiteSpace(s)) { _dialogHelper.ShowError(Activity, "The code cannot be empty."); return; } if (!Regex.IsMatch(s, "[0-9]{4,}")) { _dialogHelper.ShowError(Activity, "The code entered is incorrect."); return; } _progressBarHelper.Show(); var res = await _authHelper.ConfirmEmailAsync(new ConfirmationRequestDto { Code = s, UserId = userId }); _progressBarHelper.Hide(); if (res.StatusCode == HttpStatusCode.OK) { Dismiss(); var activity = Activity; _dialogHelper.ShowSuccessDialog(Activity, "Signing Up was successful. Please Sign In" , (o, ea) => { activity.StartActivity(typeof(SignInActivity)); activity.Finish(); }); } else if (res.StatusCode == HttpStatusCode.BadRequest) { _dialogHelper.ShowError(Activity, "The code entered is incorrect."); } else { _dialogHelper.ShowError(Activity); } } catch (Exception ex) { Log.WriteLine(LogPriority.Error, "Planner Error", ex.Message); _progressBarHelper.Hide(); _dialogHelper.ShowError(Activity, ex); } }