private void Button_Click(object sender, RoutedEventArgs e) { if (txtbox_password.Password.ToString() == "") { showErrorAndFocusField(txtbox_password); } else if (txtbox_Confirm_Password.Password.ToString() == "") { showErrorAndFocusField(txtbox_Confirm_Password); } else if (txtbox_question.Text == "") { labelError.Content = "Complete the fields marked"; txtbox_question.Focus(); txtbox_question.Foreground = (Brush)brushConverter.ConvertFrom("#e74c3c"); } else { setLog(); userservice.userNew(txtbox_password.Password.ToString(), Combo_question.Text, txtbox_question.Text); MaterialDesignThemes.Wpf.DialogHost.CloseDialogCommand.Execute(null, null); } }