private void ForgotPasswordTextView_Click(object sender, EventArgs e) { resetListener = new ResetPasswordListener(); resetPasswordFragment = new ResetPasswordFragment(); //this.Window.SetBackgroundDrawable(new Android.Graphics.Drawables.ColorDrawable(Android.Graphics.Color.Transparent)); var trans = SupportFragmentManager.BeginTransaction(); resetPasswordFragment.Cancelable = true; resetPasswordFragment.Show(trans, "reset_password"); resetPasswordFragment.OnPasswordReset += (s, args) => { string email = args.Email; if (email != "") { Android.Support.V7.App.AlertDialog.Builder confirmResetDialog = new Android.Support.V7.App.AlertDialog.Builder(this, Resource.Style.AppCompatAlertDialogStyle); confirmResetDialog.SetMessage("Reset password?"); confirmResetDialog.SetNegativeButton("Cancel", (thisalert, args) => { resetPasswordFragment.Dismiss(); }); confirmResetDialog.SetPositiveButton("Reset", (thisalert, args) => { resetListener.ResetPassword(auth, email); resetPasswordFragment.Dismiss(); }); confirmResetDialog.Show(); } else { Toast.MakeText(this, "Please enter an email", ToastLength.Short).Show(); } }; resetListener.listener.Failure += (s, args) => { Toast.MakeText(this, "Password failed to reset due to an error: " + args.Cause, ToastLength.Long).Show(); }; resetListener.listener.Success += (s, args) => { Toast.MakeText(this, "Check your mail box", ToastLength.Short).Show(); }; }
private void ChangePasswordProfileTextView_Click(object sender, EventArgs e) { resetListener = new ResetPasswordListener(); resetPasswordFragment = new ResetPasswordFragment(); var trans = SupportFragmentManager.BeginTransaction(); resetPasswordFragment.Cancelable = true; resetPasswordFragment.Show(trans, "reset_password"); resetPasswordFragment.OnPasswordReset += (s, args) => { string email = args.Email; Android.Support.V7.App.AlertDialog.Builder confirmResetDialog = new Android.Support.V7.App.AlertDialog.Builder(this, Resource.Style.AppCompatAlertDialogStyle); confirmResetDialog.SetMessage("Reset password?"); confirmResetDialog.SetNegativeButton("Cancel", (thisalert, args) => { resetPasswordFragment.Dismiss(); }); confirmResetDialog.SetPositiveButton("Reset", (thisalert, args) => { if (email == Helpers.Helper.GetEmail()) { resetListener.ResetPassword(FirebaseBackend.FirebaseBackend.GetFireAuth(), email); resetPasswordFragment.Dismiss(); } else { Toast.MakeText(this, "Please confirm your email", ToastLength.Long).Show(); } }); confirmResetDialog.Show(); }; resetListener.listener.Failure += (s, args) => { Toast.MakeText(this, "Password failed to reset due to an error: " + args.Cause, ToastLength.Long).Show(); }; resetListener.listener.Success += (s, args) => { Toast.MakeText(this, "Check your mail box", ToastLength.Short).Show(); }; }