private List<preference> GetUserPreferences(bool isAsync, GetUserPreferenceCallback callback, Object state) { var parameterList = new Dictionary<string, string> { { "method", "facebook.data.getUserPreferences" } }; if (isAsync) { SendRequestAsync<data_getUserPreferences_response, string>(parameterList, new FacebookCallCompleted<string>(callback), state); return null; } var response = SendRequest<data_getUserPreferences_response>(parameterList); return response == null ? null : response.preference; }
/// <summary> /// Gets currently authenticated user's preferences. /// </summary> /// <example> /// <code> /// /// </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 a List of id-value pairs of preferences. For preferences that are set to 0 or empty strings, they will NOT show up in the returned map.</returns> /// <remarks>For return value: /// This is a problem if you identify the preferences by numbers on your machine. /// If a user fills out preference 0, 1, 2, and 4, but neglects to fill out preference 3 (because it may be optional) --> The array returned by this function /// will map preference 4 to 3. This preference will still be identified by 4 because each initial key in the returned array stores another array that would map 4 to the user preference, /// but you may have to iterate through each array until you find this missing preference depending on how many preferences you have and how many are missing. /// </remarks> public void GetUserPreferencesAsync(GetUserPreferenceCallback callback, Object state) { GetUserPreferences(true, callback, state); }
private string GetUserPreference(int pref_id, bool isAsync, GetUserPreferenceCallback callback, Object state) { var parameterList = new Dictionary<string, string> { { "method", "facebook.data.getUserPreference" } }; Utilities.AddRequiredParameter(parameterList, "pref_id", pref_id); if (isAsync) { SendRequestAsync<data_getUserPreference_response, string>(parameterList, new FacebookCallCompleted<string>(callback), state); return null; } var response = SendRequest<data_getUserPreference_response>(parameterList); return response == null ? null : response.TypedValue; }
/// <summary> /// Gets currently authenticated user's preference. /// </summary> /// <example> /// <code> /// /// </code> /// </example> /// <param name="pref_id">(0-200) Numeric identifier of the preference to get. </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 the value of the specified preference. Empty string if the preference was not set, or it was set to "0" or empty string before.</returns> public void GetUserPreferenceAsync(int pref_id, GetUserPreferenceCallback callback, Object state) { GetUserPreference(pref_id, true, callback, state); }