コード例 #1
0
        //Функционал кнопки НАЗАД
        private void ButtonBack_Click(object sender, RoutedEventArgs e)
        {
            AuthWindow authWin = new AuthWindow();

            this.Close();
            authWin.Show();
        }
コード例 #2
0
        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();
                }
            }
        }