Exemplo n.º 1
0
Arquivo: App.xaml.cs Projeto: bdr27/c-
        private void HandleNameMenuItemPlayer1(object sender, RoutedEventArgs e)
        {
            NameInformationWindow dialog = new NameInformationWindow();
            dialog.Owner = player1Window;
            dialog.ShowDialog();
            player1Name = dialog.GetName();
            handler.sendRequest(String.Format("ID,{0}", player1Name));
            if (handler.getResponse().Equals("PLAYER1"))
            {

                player1Window.setName.IsEnabled = false;
                player2Window.setName.IsEnabled = true;
                player2Window.setStatusEnterYourName();
                player1Window.setStatusOpponmentName();
            }
            else
            {
                player1Window.setStatusInvalidName();
            }
            
        }
Exemplo n.º 2
0
Arquivo: App.xaml.cs Projeto: bdr27/c-
        private void HandleNameMenuItemPlayer2(object sender, RoutedEventArgs e)
        {
            NameInformationWindow dialog = new NameInformationWindow();
            dialog.Owner = player2Window;
            dialog.ShowDialog();
            player2Name = dialog.GetName();
            handler.sendRequest(String.Format("ID,{0}", player2Name));
            if (handler.getResponse().Equals("PLAYER2"))
            {
                player2Window.setName.IsEnabled = false;
                player1Window.setStatusYourMove();
                player2Window.setStatusOpponentsMove();
                handler.sendRequest("UPDATE");
                string boardPieces = handler.getResponse();
                drawBoard(boardPieces);

                thread.Start();
            }
            else if (!player2Name.Equals(""))
            {
                if (player1Name.Equals(player2Name))
                {
                    displaySameNameError();
                    
                }
                player2Window.setStatusInvalidName();
            }
        }