Beispiel #1
0
        private static void OnGetAppPropertiesCompleted(string result, Object state, FacebookException e)
        {
            Object[] stateArray = state != null ? (Object[])state : null;
            GetAppPropertiesCallback callback = stateArray != null && stateArray.Length > 0 ? (GetAppPropertiesCallback)stateArray[0] : null;
            var originalState = stateArray != null && stateArray.Length > 1 ? stateArray[1] : null;

            if (e == null)
            {
                if (callback != null)
                {
                    callback(JSONHelper.ConvertFromJSONAssoicativeArray(result), originalState, e);
                }
            }
            else
            {
                if (callback != null)
                {
                    callback(null, originalState, e);
                }
            }
        }
Beispiel #2
0
        private Dictionary <string, string> GetAppProperties(List <string> applicationProperties, bool isAsync, GetAppPropertiesCallback callback, Object state)
        {
            var parameterList = new Dictionary <string, string> {
                { "method", "facebook.admin.getAppProperties" }
            };

            Utilities.AddJSONArray(parameterList, "properties", applicationProperties);

            var newState = new Object[2];

            newState[0] = callback;
            newState[1] = state;

            if (isAsync)
            {
                SendRequestAsync <admin_getAppProperties_response, string>(parameterList, !string.IsNullOrEmpty(Session.SessionKey), new FacebookCallCompleted <string>(OnGetAppPropertiesCompleted), newState);
                return(null);
            }

            var response = SendRequest <admin_getAppProperties_response>(parameterList, !string.IsNullOrEmpty(Session.SessionKey));

            return(response == null ? null : JSONHelper.ConvertFromJSONAssoicativeArray(response.TypedValue));
        }
Beispiel #3
0
 /// <summary>
 /// Returns values of properties for your applications from the Facebook Developer application.
 /// </summary>
 /// <example>
 /// <code>
 /// private static void RunWebDemoAsync()
 /// {
 ///     Api api = new Api(new FBMLCanvasSession(Constants.WebApplicationKey, Constants.WebSecret));
 ///     api.Session.UserId = Constants.UserId;
 ///     List&lt;string&gt; properties = new List&lt;string&gt; { "privacy_url" };
 ///     api.Admin.GetAppPropertiesAsync(properties, AsyncWebDemoCompleted, null);
 /// }
 ///
 /// private static void AsyncWebDemoCompleted(Dictionary&lt;string, string&gt; result, Object state, FacebookException e)
 /// {
 ///     Dictionary&lt;string, string&gt; properties = result;
 /// }
 /// </code>
 /// </example>
 /// <param name="properties">A list of property names that you want to view.</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 app properties as a Dictionary collection of property name to value.</returns>
 public void GetAppPropertiesAsync(List <string> properties, GetAppPropertiesCallback callback, Object state)
 {
     GetAppProperties(properties, true, callback, state);
 }
Beispiel #4
0
 /// <summary>
 /// Returns values of properties for your applications from the Facebook Developer application.
 /// </summary>
 /// <example>
 /// <code>
 /// private static void RunWebDemoAsync()
 /// {
 ///     Api api = new Api(new FBMLCanvasSession(Constants.WebApplicationKey, Constants.WebSecret));
 ///     api.Session.UserId = Constants.UserId;
 ///     api.Admin.GetAppPropertiesAsync(AsyncWebDemoCompleted, null);
 /// }
 ///
 /// private static void AsyncWebDemoCompleted(Dictionary&lt;string, string&gt; result, Object state, FacebookException e)
 /// {
 ///     Dictionary&lt;string, string&gt; properties = 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 app properties as a Dictionary collection of property name to value.</returns>
 public void GetAppPropertiesAsync(GetAppPropertiesCallback callback, Object state)
 {
     GetAppPropertiesAsync(GetApplicationPropertyNames(), callback, state);
 }
        private Dictionary<string, string> GetAppProperties(List<string> applicationProperties, bool isAsync, GetAppPropertiesCallback callback, Object state)
        {
            var parameterList = new Dictionary<string, string> { { "method", "facebook.admin.getAppProperties" } };
            Utilities.AddJSONArray(parameterList, "properties", applicationProperties);

            var newState = new Object[2];
            newState[0] = callback;
            newState[1] = state;

            if (isAsync)
            {
                SendRequestAsync<admin_getAppProperties_response, string>(parameterList, !string.IsNullOrEmpty(Session.SessionKey), new FacebookCallCompleted<string>(OnGetAppPropertiesCompleted), newState);
                return null;
            }

            var response = SendRequest<admin_getAppProperties_response>(parameterList, !string.IsNullOrEmpty(Session.SessionKey));
            return response == null ? null : JSONHelper.ConvertFromJSONAssoicativeArray(response.TypedValue);
        }
 /// <summary>
 /// Returns values of properties for your applications from the Facebook Developer application.
 /// </summary>
 /// <example>
 /// <code>
 /// private static void RunWebDemoAsync()
 /// {
 ///     Api api = new Api(new FBMLCanvasSession(Constants.WebApplicationKey, Constants.WebSecret));
 ///     api.Session.UserId = Constants.UserId;
 ///     List&lt;string&gt; properties = new List&lt;string&gt; { "privacy_url" };
 ///     api.Admin.GetAppPropertiesAsync(properties, AsyncWebDemoCompleted, null);
 /// }
 /// 
 /// private static void AsyncWebDemoCompleted(Dictionary&lt;string, string&gt; result, Object state, FacebookException e)
 /// {
 ///     Dictionary&lt;string, string&gt; properties = result;
 /// }
 /// </code>
 /// </example>
 /// <param name="properties">A list of property names that you want to view.</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 app properties as a Dictionary collection of property name to value.</returns>
 public void GetAppPropertiesAsync(List<string> properties, GetAppPropertiesCallback callback, Object state)
 {
     GetAppProperties(properties, true, callback, state);
 }
 /// <summary>
 /// Returns values of properties for your applications from the Facebook Developer application.
 /// </summary>
 /// <example>
 /// <code>
 /// private static void RunWebDemoAsync()
 /// {
 ///     Api api = new Api(new FBMLCanvasSession(Constants.WebApplicationKey, Constants.WebSecret));
 ///     api.Session.UserId = Constants.UserId;
 ///     api.Admin.GetAppPropertiesAsync(AsyncWebDemoCompleted, null);
 /// }
 /// 
 /// private static void AsyncWebDemoCompleted(Dictionary&lt;string, string&gt; result, Object state, FacebookException e)
 /// {
 ///     Dictionary&lt;string, string&gt; properties = 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 app properties as a Dictionary collection of property name to value.</returns>
 public void GetAppPropertiesAsync(GetAppPropertiesCallback callback, Object state)
 {
     GetAppPropertiesAsync(GetApplicationPropertyNames(), callback, state);
 }