private void LoginButton_Click(object sender, RoutedEventArgs e) { DbInfo dbInfo = new DbInfo(); dbInfo.LoginPassword(usernameTextBox.Text, passwordTextBox.Password); try { dbInfo.ForLogin(); AdminWindow adminWindow = new AdminWindow(); Close(); adminWindow.Show(); } catch (SqlException ex) { MessageBox.Show(ex.Message); } }