private bool SetRestrictionInfo(Dictionary <string, string> restrictionDictionary, bool isAsync, SetRestrictionInfoCallback callback, Object state) { string restriction = JSONHelper.ConvertToJSONAssociativeArray(restrictionDictionary); var parameterList = new Dictionary <string, string> { { "method", "facebook.admin.setRestrictionInfo" } }; Utilities.AddOptionalParameter(parameterList, "restriction_str", restriction); if (isAsync) { SendRequestAsync <admin_setRestrictionInfo_response, bool>(parameterList, !string.IsNullOrEmpty(Session.SessionKey), new FacebookCallCompleted <bool>(callback), state); return(true); } var response = SendRequest <admin_setRestrictionInfo_response>(parameterList, !string.IsNullOrEmpty(Session.SessionKey)); return(response == null ? true : response.TypedValue); }
/// <summary> /// Sets the demographic restrictions for the application. /// </summary> /// <example> /// <code> /// private static void RunDemoAsync() /// { /// Api api = new Api(new FBMLCanvasSession(Constants.WebApplicationKey, Constants.WebSecret)); /// api.Session.UserId = Constants.UserId; /// Dictionary<string, string> restrictions = new Dictionary<string, string> { { "age_distribution", "10-99" } }; /// api.Admin.SetRestrictionInfoAsync(restrictions, AsyncDemoCompleted, null); /// } /// /// private static void AsyncDemoCompleted(bool result, Object state, FacebookException e) /// { /// bool actual = result; /// } /// </code> /// </example> /// <param name="restriction">A Dictionary of the restricting attributes. Restrictions include age, location, age_distribution, and type.</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 restrictions are successfully set.</returns> public void SetRestrictionInfoAsync(Dictionary <string, string> restriction, SetRestrictionInfoCallback callback, Object state) { SetRestrictionInfo(restriction, true, callback, state); }
/// <summary> /// Sets the demographic restrictions for the application. /// </summary> /// <example> /// <code> /// private static void RunDemoAsync() /// { /// Api api = new Api(new FBMLCanvasSession(Constants.WebApplicationKey, Constants.WebSecret)); /// api.Session.UserId = Constants.UserId; /// api.Admin.SetRestrictionInfoAsync(AsyncDemoCompleted, null); /// } /// /// private static void AsyncDemoCompleted(bool result, Object state, FacebookException e) /// { /// bool actual = result; /// } /// </code> /// </example> /// <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 restrictions are successfully set.</returns> public void SetRestrictionInfoAsync(SetRestrictionInfoCallback callback, Object state) { SetRestrictionInfoAsync(null, callback, state); }
private bool SetRestrictionInfo(Dictionary<string, string> restrictionDictionary, bool isAsync, SetRestrictionInfoCallback callback, Object state) { string restriction = JSONHelper.ConvertToJSONAssociativeArray(restrictionDictionary); var parameterList = new Dictionary<string, string> { { "method", "facebook.admin.setRestrictionInfo" } }; Utilities.AddOptionalParameter(parameterList, "restriction_str", restriction); if (isAsync) { SendRequestAsync<admin_setRestrictionInfo_response, bool>(parameterList, !string.IsNullOrEmpty(Session.SessionKey), new FacebookCallCompleted<bool>(callback), state); return true; } var response = SendRequest<admin_setRestrictionInfo_response>(parameterList, !string.IsNullOrEmpty(Session.SessionKey)); return response == null ? true : response.TypedValue; }
/// <summary> /// Sets the demographic restrictions for the application. /// </summary> /// <example> /// <code> /// private static void RunDemoAsync() /// { /// Api api = new Api(new FBMLCanvasSession(Constants.WebApplicationKey, Constants.WebSecret)); /// api.Session.UserId = Constants.UserId; /// Dictionary<string, string> restrictions = new Dictionary<string, string> { { "age_distribution", "10-99" } }; /// api.Admin.SetRestrictionInfoAsync(restrictions, AsyncDemoCompleted, null); /// } /// /// private static void AsyncDemoCompleted(bool result, Object state, FacebookException e) /// { /// bool actual = result; /// } /// </code> /// </example> /// <param name="restriction">A Dictionary of the restricting attributes. Restrictions include age, location, age_distribution, and type.</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 restrictions are successfully set.</returns> public void SetRestrictionInfoAsync(Dictionary<string, string> restriction, SetRestrictionInfoCallback callback, Object state) { SetRestrictionInfo(restriction, true, callback, state); }