public void areFriendsTest1() { var user1 = new user { uid = Constants.FBSamples_friend1 }; var user2 = new user {uid = Constants.FBSamples_friend2}; var actual = _api.Friends.AreFriends(user1, user2); Assert.IsTrue(actual[0].are_friends.Value); }
public void Page_Load(object sender, EventArgs e) { if (!IsPostBack) { FacebookPageManager facebook = new FacebookPageManager(SessionManager); if (string.IsNullOrEmpty(facebook.FacebookAPIKey)) { throw new Exception("This site is not configured for Facebook login: missing Facebook API key."); } if (!facebook.HasFacebookCookies(HttpContext.Current.Request.Cookies)) { Redirect(facebook.GetLoginUrl(Request.Url.ToString())); } SortedList <string, string> facebookCookies = facebook.GetFacebookCookies(HttpContext.Current.Request.Cookies); List <String> cookieNames = new List <String>(facebookCookies.Keys); List <String> cookieValues = new List <String>(facebookCookies.Values); Facebook.Schema.user user = SessionManager.FacebookGraphService.GetUser( cookieNames.ToArray(), cookieValues.ToArray()); facebookUser.SelectedObject = user; facebookUserStatus.SelectedObject = user.status; facebookUserHometownLocation.SelectedObject = user.hometown_location; facebookUserCurrentLocation.SelectedObject = user.current_location; } }
/// <summary> /// Returns whether or not each pair of specified users is friends with each other. /// </summary> /// <example> /// <code> /// Api api = new Api(new DesktopSession(Constants.ApplicationKey, Constants.ApplicationSecret, Constants.SessionSecret, Constants.SessionKey)); /// user u1 = api.Users.GetInfo(Constants.Friend_UserId1); /// user u2 = api.Users.GetInfo(Constants.Friend_UserId2); /// var result = api.Friends.AreFriends(u1, u2);/// </code> /// </example> /// <param name="user1">A user to match against user2.</param> /// <param name="user2">A user to match against user1.</param> /// <returns>Returns a list of friend_info elements corresponding to the lists passed. The are_friends subelement of each friend_info element is 0 or false if the users are not friends, and 1 or true if they are friends. Note that, for each pair, this function is symmetric. That is, it does not matter which user is in uids1 and which is in uids2.</returns> /// <remarks>The first array specifies one half of each pair, the second array the other half; therefore, they must be of equal size.</remarks> public IList<friend_info> AreFriends(user user1, user user2) { var uids1 = new List<long>(); var uids2 = new List<long>(); uids1.Add(user1.uid.Value); uids2.Add(user2.uid.Value); return AreFriends(uids1, uids2); }
/// <summary> /// Constructor /// </summary> public ProfileListItem(user user) : this() { User = user; LoadUser(); }
/// <summary> /// Constructor /// </summary> public ProfileItemSelectedEventArgs(user user) { User = user; }
/// <summary> /// constructor /// </summary> public FriendSelectedEventArgs(user user) { User = user; }
private void LoadWorkInfoPanel(user user) { tlpWork.Controls.Clear(); if (user.work_history == null || user.work_history.work_info.Count <= 0) return; var row = 0; foreach (var job in user.work_history.work_info) { if (!String.IsNullOrEmpty(job.company_name)) { tlpWork.Controls.Add(CreatePromptLabel(Resources.lblEmployer), 0, row); tlpWork.Controls.Add(CreateValueLabel(job.company_name), 1, row); row++; } if (!String.IsNullOrEmpty(job.position)) { tlpWork.Controls.Add(CreatePromptLabel(Resources.lblPosition), 0, row); tlpWork.Controls.Add(CreateValueLabel(job.position), 1, row); row++; } if (!String.IsNullOrEmpty(job.start_date)) { var timePeriod = new StringBuilder(); timePeriod.Append(job.start_date); timePeriod.Append(" - "); timePeriod.Append(job.end_date); tlpWork.Controls.Add(CreatePromptLabel(Resources.lblTimePeriod), 0, row); tlpWork.Controls.Add(CreateValueLabel(timePeriod.ToString()), 1, row); row++; } if (job.location != null) { tlpWork.Controls.Add(CreatePromptLabel(Resources.lblLocation), 0, row); tlpWork.Controls.Add(CreateValueLabel(job.location.city + ", " + job.location.state), 1, row); row++; } if (!String.IsNullOrEmpty(job.description)) { tlpWork.Controls.Add(CreatePromptLabel(Resources.lblDescription), 0, row); tlpWork.Controls.Add(CreateValueLabel(job.description), 1, row); row++; } tlpWork.Controls.Add(new Label(), 0, row); tlpWork.Controls.Add(new Label(), 1, row); row++; } foreach (RowStyle rowStyle in tlpWork.RowStyles) { rowStyle.SizeType = SizeType.AutoSize; } }
private void LoadPicture(user user) { if (user.pic != null) { pbProfilePicture.ImageLocation = user.pic; } else { pbProfilePicture.Image = user.picture; } }
private void LoadPersonalInfoPanel(user user) { SetRowValue(tlpPersonal, lblActivities, user.activities); SetRowValue(tlpPersonal, lblInterests, user.interests); SetRowValue(tlpPersonal, lblFavoriteMusic, user.music); SetRowValue(tlpPersonal, lblFavoriteTVShows, user.tv); SetRowValue(tlpPersonal, lblFavoriteMovies, user.movies); SetRowValue(tlpPersonal, lblFavoriteBooks, user.books); SetRowValue(tlpPersonal, lblFavoriteQuotes, user.quotes); SetRowValue(tlpPersonal, lblAboutMe, user.about_me); }
private void LoadEducationInfoPanel(user user) { tpEducation.Controls.Clear(); if ((user.education_history == null) || (user.education_history.education_info == null)) return; var collegeText = new StringBuilder(); foreach (var education in user.education_history.education_info) { collegeText.Append(education.name); collegeText.Append(" '"); if (education.year > 0) collegeText.AppendLine(education.year.ToString(CultureInfo.InvariantCulture).Substring(2)); foreach (var concentration in education.concentrations.concentration) { collegeText.AppendLine(concentration); } } SetRowValue(tlpEducation, lblCollege, collegeText.ToString().Trim()); }
private void LoadBasicInfoPanel(user user) { lblName.Text = user.name; lblLocation.Text = user.current_location.city + ", " + user.current_location.state; SetRowValue(tlpBasic, lblSex, user.sex); if (user.meeting_sex != null) { SetRowValue(tlpBasic, lblInterestedIn, string.Join(",", user.meeting_sex.sex.ToArray())); } else { SetRowValue(tlpBasic, lblInterestedIn, string.Empty); } SetRowValue(tlpBasic, lblRelationshipStatus, user.relationship_status); if (user.meeting_for != null) { SetRowValue(tlpBasic, lblLookingFor, string.Join(",", user.meeting_for.seeking.ToArray())); } else { SetRowValue(tlpBasic, lblLookingFor, string.Empty); } SetRowValue(tlpBasic, lblBirthday, user.birthday); if (user.hometown_location != null) { SetRowValue(tlpBasic, lblHometown, user.hometown_location.city + ", " + user.hometown_location.state); } else { SetRowValue(tlpBasic, lblHometown, string.Empty); } SetRowValue(tlpBasic, lblPoliticalViews, user.political); SetRowValue(tlpBasic, lblReligiousViews, user.religion); }
/// <summary> /// Returns whether or not each pair of specified users is friends with each other. /// </summary> /// <example> /// <code> /// private static void RunDemoAsync() /// { /// Api api = new Api(new DesktopSession(Constants.ApplicationKey, Constants.ApplicationSecret, Constants.SessionSecret, Constants.SessionKey)); /// user u1 = api.Users.GetInfo(Constants.Friend_UserId1); /// user u2 = api.Users.GetInfo(Constants.Friend_UserId2); /// api.Friends.AreFriendsAsync(u1, u2, AsyncDemoCompleted, null); /// } /// /// private static void AsyncDemoCompleted(IList<friend_info> result, Object state, FacebookException e) /// { /// var actual = result; /// }/// </code> /// </example> /// <param name="user1">A user to match against user2.</param> /// <param name="user2">A user to match against user1.</param> /// <param name="callback">The AsyncCallback delegate</param> /// <param name="state">An object containing state information for this asynchronous request</param> /// <returns>Returns a list of friend_info elements corresponding to the lists passed. The are_friends subelement of each friend_info element is 0 or false if the users are not friends, and 1 or true if they are friends. Note that, for each pair, this function is symmetric. That is, it does not matter which user is in uids1 and which is in uids2.</returns> /// <remarks>The first array specifies one half of each pair, the second array the other half; therefore, they must be of equal size.</remarks> public void AreFriendsAsync(user user1, user user2, AreFriendsCallback callback, Object state) { var u1 = new List<long>(); var u2 = new List<long>(); u1.Add(user1.uid.Value); u2.Add(user2.uid.Value); AreFriendsAsync(u1, u2, callback, state); }
/// <summary> /// Constructor /// </summary> public InviteeSelectedEventArgs(user invitee) { Invitee = invitee; }