Ejemplo n.º 1
0
        public void JoinRoom(AvailableRoom room)
        {
            string password    = string.Empty;
            bool   attemptJoin = true;

            if (room.RequiresPassword)
            {
                Pages.RoomPasswordEntry passwordEntryWindow = new Pages.RoomPasswordEntry();
                passwordEntryWindow.ShowDialog();
                password    = passwordEntryWindow.LatestPassword;
                attemptJoin = passwordEntryWindow.PasswordEntered;
                passwordEntryWindow.Reset();
                passwordEntryWindow = null;
            }

            if (attemptJoin)
            {
                JoinRoomOutcome outcome = client.JoinRoom(room, password);
                switch (outcome)
                {
                case JoinRoomOutcome.Success:
                    ShowChatPage();
                    chatPage.OutputTextSafe(string.Format("Joined '{0}', type '/help' for a list of commnads.", room.Name), false);
                    break;

                case JoinRoomOutcome.Fail:
                    MessageBox.Show("Could not join the room.", "Join Error");
                    break;

                case JoinRoomOutcome.InvalidPassword:
                    MessageBox.Show("Invalid password.", "Join Error");
                    break;
                }
            }
        }
Ejemplo n.º 2
0
 public JoinRoomOutcome JoinRoom(AvailableRoom room, string password = "")
 {
     return(JoinRoom(room.ID, password));
 }