public void OpenAuthorizationWindow()
 {
     Views.Authorization authorization = new Views.Authorization();
     authorization.Show();
     foreach (Window window in App.Current.Windows)
     {
         // если окно - объект Registration
         if (window is Views.Registration)
         {
             window.Close();
         }
     }
 }
        public void DeleteUserProfile()
        {
            using (SqlConnection dbConn = new SqlConnection())
            {
                dbConn.ConnectionString = ConfigurationManager.ConnectionStrings["YourPianoConnection"].ConnectionString;
                dbConn.Open();
                SqlTransaction transaction = dbConn.BeginTransaction();
                SqlCommand     command     = dbConn.CreateCommand();
                command.Transaction = transaction;
                try
                {
                    string sqlExpression = $"delete ProgressInfo where userID = '{CurrentUser.userID}'";
                    command.CommandText = sqlExpression;
                    command.ExecuteNonQuery();

                    sqlExpression       = $"delete NoteSequence where ID in (select ActionInfo.noteSecuence from ActionInfo where userID = {CurrentUser.userID})";
                    command.CommandText = sqlExpression;
                    command.ExecuteNonQuery();

                    sqlExpression       = $"delete UserInfo where username = '******'";
                    command.CommandText = sqlExpression;
                    command.ExecuteNonQuery();

                    // подтверждаем транзакцию
                    transaction.Commit();
                    MessageBox.Show("Пользователь успешно удален");
                    foreach (Window window in App.Current.Windows)
                    {
                        // если окно - объект MainWindow
                        if (window is Views.MainWindow)
                        {
                            window.Close();
                        }
                    } //закрытие текущего окна
                    Views.Authorization auth = new Views.Authorization();
                    auth.Show();
                }
                catch (SqlException ex)
                {
                    MessageBox.Show(ex.Message);
                    transaction.Rollback();
                }
                finally { dbConn.Close(); }
            }
        }