Beispiel #1
0
        private void connectButton_Click(object sender, EventArgs e)
        {
            String serverAdress = serverTextBox.Text;
            String userName = userNameTextBox.Text;
            ludo.ServerAdress = serverAdress;
            User user = new User();
            user.UserName = userName;
            ludo.Users.Add(user);
            authenticationHandler = new AuthenticationHandler(ludo);

            rootConnectTableLayout.Hide();
            rootServerTableLayout.Show();
        }
Beispiel #2
0
        private void connectButton_Click(object sender, EventArgs e)
        {
            connectButton.Enabled = false;

            Main main = new Main(); // Run Construtor of Main to initialize Main Ludo Object
            String serverAdress = serverTextBox.Text;
            String userName = userNameTextBox.Text;
            ClientBase.serverAdress = serverAdress;

            user = new User();
            user.UserName = userName;
            Main.ludo.Users.Add(user);

            authenticationHandler = new AuthenticationHandler(user);

            if (authenticationSuceed())
            {
                //Main.ludo.Users[ClientBase.myUserListIndex].CurrentView = "server";
                onlineUserHandler = new OnlineUserHandler(this.onlineUserList);
                chatHandler = new ChatHandler(this.messageList, this.roomMessageList);
                roomHandler = new RoomHandler(this.roomList, this.userInLobbyListBox, this.readyButton, this.startButton, this.backButton,
                    this.roomMessageList, this.gameTableLayout, this.gameFieldPanel, this.dicePictureBox, this.rollTheDiceButton, this.playerListBox);

                ClientBase.isConnected = true;

                rootConnectTableLayout.Hide();
                rootServerTableLayout.Show();
                messageTextBox.Focus();
                this.UseWaitCursor = false;
            }
            else
            {
                ClientBase.myUserListIndex = -1;
                Main.ludo.Users.Clear();
                connectButton.Enabled = true;
            }
        }