private bool IsAppUser(long uid, bool isAsync, IsAppUserCallback callback, Object state) { var parameterList = new Dictionary<string, string> { { "method", "facebook.users.isAppUser" } }; Utilities.AddOptionalParameter(parameterList, "uid", uid); if (isAsync) { SendRequestAsync<users_isAppUser_response, bool>(parameterList, !string.IsNullOrEmpty(Session.SessionKey), new FacebookCallCompleted<bool>(callback), state); return false; } var response = SendRequest<users_isAppUser_response>(parameterList, !string.IsNullOrEmpty(Session.SessionKey)); return response == null ? true : response.TypedValue; }
/// <summary> /// Returns whether the user (either the session user or user specified by UID) has authorized the calling application. /// </summary> /// <example> /// <code> /// private static void RunDemoAsync() /// { /// Api api = new Api(new DesktopSession(Constants.ApplicationKey, Constants.ApplicationSecret, Constants.ApplicationSecret, Constants.SessionKey)); /// api.Users.IsAppUserAsync(Constants.UserId, AsyncDemoCompleted, null); /// } /// /// private static void AsyncDemoCompleted(bool result, Object state, FacebookException e) /// { /// var actual = result; /// } /// </code> /// </example> /// <param name="uid">The user ID of the user who may have authorized the application. If this parameter is not specified, then it defaults to the session user. Note: This parameter applies only to Web applications. Facebook ignores this parameter if it is passed by a desktop application.</param> /// <param name="callback">The AsyncCallback delegate</param> /// <param name="state">An object containing state information for this asynchronous request</param> /// <returns>Returns true or false.</returns> public void IsAppUserAsync(long uid, IsAppUserCallback callback, Object state) { IsAppUser(uid, true, callback, state); }