MainWindow mwin = new MainWindow(); Application.Current.MainWindow = mwin; this.Close(); mwin.Show();