private async void btnCreateAccount_Click(object sender, RoutedEventArgs e) { if (Misc.Utils.IsValidEmail(txtNewEmail.Text) && !txtNewNomUser.Text.Equals("") && !txtNewPassword.Password.Equals("")) { btnCreateAccount.IsEnabled = false; if (await Insert.CreateNewAccount(txtNewNomUser.Text, txtNewEmail.Text, txtNewPassword.Password)) { ChkBoxRememberAccount.IsChecked = false; Usertxt.Text = txtNewNomUser.Text; Passwordtxt.Password = txtNewPassword.Password; ChkBoxRememberAccount.IsChecked = true; txtNewNomUser.Text = ""; txtNewEmail.Text = ""; txtNewPassword.Password = ""; chkHeader.IsChecked = false; btnCreateAccount.IsEnabled = true; ShowHideMenu("sbHideRightMenu", btnRightMenuHide, btnRightMenuShow, pnlRightMenu); await UserLogIn(); await RefreshLB(); } } else { MessageBox.Show("Username, email and/or password are not valid."); } btnCreateAccount.IsEnabled = true; }