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; } } }
public JoinRoomOutcome JoinRoom(AvailableRoom room, string password = "") { return(JoinRoom(room.ID, password)); }