private void OnLoggedIn(object source, EventArgs args) { var loginViewModel = (LoginViewModel)source; Dispatcher.Invoke(() => { (DataContext as MainViewModel).SocketClient.ConnectionLost += SocketClientOnConnectionLost; AfterLogin(loginViewModel); ChatBox.AfterLogin(); LoginScreen.AfterLogin(); Profile.AfterLogin(); Home.AfterLogin(); Lobby.AfterLogin(); }); }