예제 #1
0
		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);
			}
		}
예제 #2
0
 void System.Windows.Markup.IComponentConnector.Connect(int connectionId, object target) {
     switch (connectionId)
     {
     case 1:
     this.Lobby = ((BattleShip.LobbyPage)(target));
     return;
     case 3:
     this.LayoutRoot = ((System.Windows.Controls.Grid)(target));
     return;
     case 4:
     this.userlist = ((System.Windows.Controls.StackPanel)(target));
     return;
     case 5:
     this.chat = ((BattleShip.Chat)(target));
     return;
     case 6:
     this.GameList = ((System.Windows.Controls.ListView)(target));
     return;
     case 7:
     this.createGameButton = ((System.Windows.Controls.Button)(target));
     
     #line 141 "..\..\..\LobbyPage.xaml"
     this.createGameButton.Click += new System.Windows.RoutedEventHandler(this.createGameButton_Click);
     
     #line default
     #line hidden
     return;
     case 8:
     this.randomGameButton = ((System.Windows.Controls.Button)(target));
     
     #line 151 "..\..\..\LobbyPage.xaml"
     this.randomGameButton.Click += new System.Windows.RoutedEventHandler(this.randomGameButton_Click);
     
     #line default
     #line hidden
     return;
     case 9:
     this.CreateGameDialog = ((BattleShip.CreateGameDialog)(target));
     return;
     }
     this._contentLoaded = true;
 }
예제 #3
0
		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);
            }
		}
예제 #4
0
        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);
        }