private void SetupHireFriendFrame(IGuiFrame hireFrame, Jobs job) { mStartLevelButton.Disable(); mHireFrame = hireFrame; mJobToHireFor = job; mUserNameFilterBox = hireFrame.GetContainer <ITopLevel>().SelectSingleElement <Textbox>("**/FriendSearchBox"); // Hide the feedback label until after the hiring is complete. mHireFeedbackLabel = hireFrame.GetContainer <ITopLevel>().SelectSingleElement <Label>("**/HireFeedbackLabel"); mHireFeedbackLabel.Showing = false; if (mUserNameFilterBox != null) { mUserNameFilterBox.AddTextChangedCallback(LayoutFriends); } mFriendHired = false; mHireFriendPrototypeFrame = hireFrame.SelectSingleElement <IGuiFrame>("HireFriendPrototypeFrame"); if (mHireFriendPrototypeFrame == null) { throw new Exception("No HireFriendPrototypeFrame was found in the level GUI for this level"); } mFriendListingStartPosition = hireFrame.GetChildPosition(mHireFriendPrototypeFrame); hireFrame.RemoveChildWidget(mHireFriendPrototypeFrame); GetFriendsToHire(job, delegate(IDictionary <long, FacebookFriendInfo> possibleHires) { // SortedList doesn't support multiple keys with the same value, so to support // friends that have the same name, we need to make the last name fields unique int uniqueifyingKeySuffix = 0; foreach (KeyValuePair <long, FacebookFriendInfo> possibleHire in possibleHires) { mPossibleHires.Add(possibleHire.Value.FirstName + possibleHire.Value.LastName + uniqueifyingKeySuffix++, possibleHire.Value); } LayoutFriends(); Scrollbar scrollbar = ((IGuiContainer)hireFrame.Parent).SelectSingleElement <Scrollbar>("ScrollBar"); if (scrollbar != null) { scrollbar.Percent = 0.0f; } }); }