private long GetLoggedInUser(bool isAsync, GetLoggedInUserCallback callback, Object state) { var parameterList = new Dictionary<string, string> { { "method", "facebook.users.getLoggedInUser" } }; if (isAsync) { SendRequestAsync<users_getLoggedInUser_response, long>(parameterList, new FacebookCallCompleted<long>(callback), state); return 0; } var response = SendRequest<users_getLoggedInUser_response>(parameterList); return response == null ? 0 : response.TypedValue; }
/// <summary> /// Gets the user ID (uid) associated with the current session. /// </summary> /// <example> /// <code> /// private static void RunDemoAsync() /// { /// Api api = new Api(new DesktopSession(Constants.ApplicationKey, Constants.ApplicationSecret, Constants.ApplicationSecret, Constants.SessionKey)); /// api.Users.GetLoggedInUserAsync(AsyncDemoCompleted, null); /// } /// /// private static void AsyncDemoCompleted(long result, Object state, FacebookException e) /// { /// var 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 the user ID (uid) associated with the current session.</returns> public void GetLoggedInUserAsync(GetLoggedInUserCallback callback, Object state) { GetLoggedInUser(true, callback, state); }