private void startButton_MouseLeftButtonUp(object sender, System.Windows.Input.MouseButtonEventArgs e) { LoginDialogResult result = LoginControl.Show(); if(result == LoginDialogResult.OK) { string username = LoginControl.UserNameTextBox.Text; UserAccount account = new UserAccount(username, 0); LobbyPage lobby = new LobbyPage(account); LobbyWindow window = Connector.lanGame(account, lobby); lobby.register(window); MainWindow.NavigateToPage(lobby); } }
public void exitGameToLobby() { if (enemy != null) { endGame(enemy, ""); } else { this.Dispatcher.BeginInvoke(DispatcherPriority.Normal, (DispatcherOperationCallback)delegate(object arg) { gameWindow.unSubscribe(); LobbyPage lobby = new LobbyPage(user); LobbyWindow window = Connector.lanGame(user, lobby); lobby.register(window); MainWindow.NavigateToPage(lobby); return null; }, null); } }
public void endGame(UserAccount winner, string connectionStringLobby) { this.Dispatcher.BeginInvoke(DispatcherPriority.Normal, (DispatcherOperationCallback)delegate(object arg) { if(winner.Equals(user)) { WinnerDialog.Show(true); } else { WinnerDialog.Show(false); } gameWindow.unSubscribe(); LobbyPage lobby = new LobbyPage(user); LobbyWindow window = Connector.lanGame(user, lobby); lobby.register(window); MainWindow.NavigateToPage(lobby); return null; }, null); }