private void Window_Loaded(object sender, RoutedEventArgs e) { //Подключение к БД using (SqlConnection conn = DBUtils.GetDBConnection()) { try { conn.Open(); conn.Close(); } catch (Exception) { MessageBox.Show("Sorry, data access has been suspended.\nСontact the administrator", "Data access error", MessageBoxButton.OK, MessageBoxImage.Error); AuthWindow authWin = new AuthWindow(); this.Close(); authWin.Show(); } } }