Ejemplo n.º 1
0
        private bool SetFBML(long uid, string profile, string profile_main, string mobile_profile,
                             bool isAsync, SetFBMLCallback callback, Object state)
        {
            var parameterList = new Dictionary <string, string> {
                { "method", "facebook.profile.setFBML" }
            };

            Utilities.AddOptionalParameter(parameterList, "uid", uid);
            Utilities.AddOptionalParameter(parameterList, "profile", profile);
            Utilities.AddOptionalParameter(parameterList, "profile_main", profile_main);
            Utilities.AddOptionalParameter(parameterList, "mobile_profile", mobile_profile);

            if (isAsync)
            {
                SendRequestAsync <profile_setFBML_response, bool>(parameterList, !string.IsNullOrEmpty(Session.SessionKey), new FacebookCallCompleted <bool>(callback), state);
                return(true);
            }

            var response = SendRequest <profile_setFBML_response>(parameterList, !string.IsNullOrEmpty(Session.SessionKey));

            return(response == null ? true : response.TypedValue);
        }
Ejemplo n.º 2
0
 /// <summary>
 /// Sets the FBML for a user's profile, including the content for both the profile box and the profile actions.
 /// </summary>
 /// <example>
 /// <code>
 /// private static void RunDemoAsync()
 /// {
 ///     Api api = new Api(new DesktopSession(Constants.ApplicationKey, Constants.ApplicationSecret, Constants.ApplicationSecret, Constants.SessionKey));
 ///     api.Session.UserId = Constants.UserId;
 ///     string fbml = string.Format("&lt;fb:name uid=\"{0}\"&gt; is testing setFBML.&lt;/fb:name&gt;", Constants.UserId);
 ///     api.Profile.SetFBMLAsync(Constants.UserId, fbml, fbml, fbml, AsyncDemoCompleted, null);
 /// }
 ///
 /// private static void AsyncDemoCompleted(bool result, Object state, FacebookException e)
 /// {
 ///     var actual = result;
 /// }
 /// </code>
 /// </example>
 /// <param name="uid">The user whose profile is to be updated. Not allowed for desktop applications (since the application secret is essentially public).</param>
 /// <param name="profile">The FBML intended for the application profile box on the user's profile. </param>
 /// <param name="profile_main">The FBML intended for the narrow profile box on the Wall tab of the user's profile.</param>
 /// <param name="mobile_profile">The FBML intended for mobile devices. </param>
 /// <param name="callback">The AsyncCallback delegate</param>
 /// <param name="state">An object containing state information for this asynchronous request</param>
 /// <returns>This method returns true if FBML was set for a profile.</returns>
 /// <remarks>The FBML is cached on Facebook's server for that particular user and that particular application. To change it, profile.setFBML must be called through a canvas page or some other script (such as a cron job) that makes use of the Facebook API. </remarks>
 public void SetFBMLAsync(long uid, string profile, string profile_main, string mobile_profile, SetFBMLCallback callback, Object state)
 {
     SetFBML(uid, profile, profile_main, mobile_profile, true, callback, state);
 }