private bool BanUsers(List <long> uids, bool isAsync, BanUsersCallback callback, Object state) { var parameterList = new Dictionary <string, string> { { "method", "facebook.admin.banUsers" } }; Utilities.AddJSONArray(parameterList, "uids", uids); if (isAsync) { SendRequestAsync <admin_banUsers_response, bool>(parameterList, !string.IsNullOrEmpty(Session.SessionKey), new FacebookCallCompleted <bool>(callback), state); return(true); } var response = SendRequest <admin_banUsers_response>(parameterList, !string.IsNullOrEmpty(Session.SessionKey)); return(response == null ? true : response.TypedValue); }
private bool BanUsers(List<long> uids, bool isAsync, BanUsersCallback callback, Object state) { var parameterList = new Dictionary<string, string> { { "method", "facebook.admin.banUsers" } }; Utilities.AddJSONArray(parameterList, "uids", uids); if (isAsync) { SendRequestAsync<admin_banUsers_response, bool>(parameterList, !string.IsNullOrEmpty(Session.SessionKey), new FacebookCallCompleted<bool>(callback), state); return true; } var response = SendRequest<admin_banUsers_response>(parameterList, !string.IsNullOrEmpty(Session.SessionKey)); return response == null ? true : response.TypedValue; }
/// <summary> /// Prevents users from accessing an application's canvas page and its forums. /// </summary> /// <example> /// <code> /// private static void RunDemoAsync() /// { /// Api api = new Api(new FBMLCanvasSession(Constants.WebApplicationKey, Constants.WebSecret)); /// api.Session.UserId = Constants.UserId; /// List<long> uids = new List<long> { 1000001, 1000002 }; /// api.Admin.BanUsersAsync(uids, AsyncDemoCompleted, null); /// } /// /// private static void AsyncDemoCompleted(string result, Object state, FacebookException e) /// { /// var actual = result; /// } /// </code> /// </example> /// <param name="uids">A List of user IDs to ban.</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 users were successfully banned.</returns> public void BanUsersAsync(List <long> uids, BanUsersCallback callback, Object state) { BanUsers(uids, true, callback, state); }
/// <summary> /// Prevents users from accessing an application's canvas page and its forums. /// </summary> /// <example> /// <code> /// private static void RunDemoAsync() /// { /// Api api = new Api(new FBMLCanvasSession(Constants.WebApplicationKey, Constants.WebSecret)); /// api.Session.UserId = Constants.UserId; /// List<long> uids = new List<long> { 1000001, 1000002 }; /// api.Admin.BanUsersAsync(uids, AsyncDemoCompleted, null); /// } /// /// private static void AsyncDemoCompleted(string result, Object state, FacebookException e) /// { /// var actual = result; /// } /// </code> /// </example> /// <param name="uids">A List of user IDs to ban.</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 users were successfully banned.</returns> public void BanUsersAsync(List<long> uids, BanUsersCallback callback, Object state) { BanUsers(uids, true, callback, state); }