private void btnStartGame_Click(object sender, RoutedEventArgs e) { if (Properties.Settings.Default.user_name.Length == 0) { MessageBox.Show("You need to Login/Register to start a game!"); return; } WaitingWindow waitingWin = new WaitingWindow(); waitingWin.Show(); this.Close(); new Thread(() => { GameFlow gameFlow = new GameFlow(Properties.Settings.Default.user_email); Application.Current.Dispatcher.Invoke(new Action(() => { Game game = new Game(gameFlow); game.Show(); waitingWin.Close(); })); }).Start(); Thread.Sleep(2000); }