private async void BtnAdd_Clicked(object sender, EventArgs e) { try { var ususE = await firebaseHelper.GetAllUsuarios(); bool isEmail = Regex.IsMatch(txtemail.Text, @"\A(?:[a-z0-9!#$%&'*+/=?^_`{|}~-]+(?:\.[a-z0-9!#$%&'*+/=?^_`{|}~-]+)*@(?:[a-z0-9](?:[a-z0-9-]*[a-z0-9])?\.)+[a-z0-9](?:[a-z0-9-]*[a-z0-9])?)\Z", RegexOptions.IgnoreCase); if (!isEmail) { await this.DisplayAlert("Advertencia", "El formato del correo electrónico es incorrecto, revíselo e intente de nuevo.", "OK"); } else if (String.IsNullOrWhiteSpace(txtemail.Text)) { await this.DisplayAlert("Advertencia", "El campo del email es obligatorio.", "OK"); } else if (String.IsNullOrWhiteSpace(txtpassword.Text)) { await this.DisplayAlert("Advertencia", "El campo del password es obligatorio.", "OK"); } else if (ususE.Where(x => x.email == txtemail.Text).Count() == 1) { await this.DisplayAlert("Advertencia", "YA EXISTE ESE USUARIO HEHE", "OK"); } else { DateTime FECHA = DateTime.Now; var all = await firebaseHelper.GetAllUsuarios(); string Uids = "asse-" + all.Count().ToString(); await firebaseHelper.AddUsuario(Uids, txtemail.Text, txtpassword.Text, PickUtipo.SelectedItem.ToString(), FECHA.ToString("MM-dd-yyy"), PickUarea.SelectedItem.ToString()); txtUid.Text = string.Empty; txtemail.Text = string.Empty; txtpassword.Text = string.Empty; await DisplayAlert("Success", "usuario agregado", "OK"); var allUsuarios = await firebaseHelper.GetAllUsuarios(); lstPersons.ItemsSource = allUsuarios; } } catch (Exception) { await this.DisplayAlert("Advertencia", "no deve haver campos vacios.", "OK"); } }