private bool SetRefHandle(string handle, string fbml, bool isAsync, SetRefHandleCallback callback, Object state) { var parameterList = new Dictionary <string, string> { { "method", "facebook.fbml.setRefHandle" } }; Utilities.AddRequiredParameter(parameterList, "handle", handle); Utilities.AddRequiredParameter(parameterList, "fbml", fbml); if (isAsync) { SendRequestAsync <fbml_setRefHandle_response, bool>(parameterList, !string.IsNullOrEmpty(Session.SessionKey), new FacebookCallCompleted <bool>(callback), state); return(true); } var response = SendRequest <fbml_setRefHandle_response>(parameterList, !string.IsNullOrEmpty(Session.SessionKey)); return(response == null ? true : response.TypedValue); }
private bool SetRefHandle(string handle, string fbml, bool isAsync, SetRefHandleCallback callback, Object state) { var parameterList = new Dictionary<string, string> {{"method", "facebook.fbml.setRefHandle"}}; Utilities.AddRequiredParameter(parameterList, "handle", handle); Utilities.AddRequiredParameter(parameterList, "fbml", fbml); if (isAsync) { SendRequestAsync<fbml_setRefHandle_response, bool>(parameterList, !string.IsNullOrEmpty(Session.SessionKey), new FacebookCallCompleted<bool>(callback), state); return true; } var response = SendRequest<fbml_setRefHandle_response>(parameterList, !string.IsNullOrEmpty(Session.SessionKey)); return response == null ? true : response.TypedValue; }
/// <summary> /// Associates a given "handle" with FBML markup so that the handle can be used within the fb:ref FBML tag. /// </summary> /// <example> /// <code> /// private static void RunDemoAsync() /// { /// Api api = new Api(new FBMLCanvasSession(Constants.WebApplicationKey, Constants.WebSecret)); /// api.Session.UserId = Constants.UserId; /// string handle = "my handle"; /// string fbml = string.Format("<fb:switch><fb:profile-pic uid=\"{0}\" /><fb:default>Unable to show profile pic</fb:default></fb:switch>", Constants.UserId); /// api.Fbml.SetRefHandleAsync(handle, fbml, AsyncDemoCompleted, null); /// } /// /// private static void AsyncDemoCompleted(bool result, Object state, FacebookException e) /// { /// var actual = result; /// } /// </code> /// </example> /// <param name="handle">The handle to associate with the given FBML.</param> /// <param name="fbml">The FBML to associate with the given handle.</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 the given handle was associated with FBML markup.</returns> public void SetRefHandleAsync(string handle, string fbml, SetRefHandleCallback callback, Object state) { SetRefHandle(handle, fbml, true, callback, state); }