示例#1
0
        private bool Rsvp(long eid, string rsvpStatus, bool isAsync, RsvpCallback callback, Object state)
        {
            var parameterList = new Dictionary <string, string> {
                { "method", "facebook.events.rsvp" }
            };

            Utilities.AddRequiredParameter(parameterList, "eid", eid);
            Utilities.AddRequiredParameter(parameterList, "rsvp_status", rsvpStatus);

            if (isAsync)
            {
                SendRequestAsync <events_rsvp_response, bool>(parameterList, new FacebookCallCompleted <bool>(callback), state);
                return(true);
            }

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

            return(response == null ? false : response.TypedValue);
        }
        private bool Rsvp(long eid, string rsvpStatus, bool isAsync, RsvpCallback callback, Object state)
        {
            var parameterList = new Dictionary<string, string> {{"method", "facebook.events.rsvp"}};
            Utilities.AddRequiredParameter(parameterList, "eid", eid);
            Utilities.AddRequiredParameter(parameterList, "rsvp_status", rsvpStatus);

            if (isAsync)
            {
                SendRequestAsync<events_rsvp_response, bool>(parameterList, new FacebookCallCompleted<bool>(callback), state);
               return true;
            }

            var response = SendRequest<events_rsvp_response>(parameterList, !string.IsNullOrEmpty(Session.SessionKey));
            return response == null ? false : response.TypedValue;
        }
示例#3
0
 /// <summary>
 /// Sets the attendance option for the current user.
 /// </summary>
 /// <example>
 /// <code>
 /// private static void RunDemoAsync()
 /// {
 ///     Api api = new Api(new DesktopSession(Constants.ApplicationKey, Constants.ApplicationSecret, Constants.ApplicationSecret, Constants.SessionKey));
 ///     api.Events.RsvpAsync(Constants.EventId, "attending", AsyncDemoCompleted, null);
 /// }
 ///
 /// private static void AsyncDemoCompleted(bool result, Object state, FacebookException e)
 /// {
 ///     var actual = result;
 /// }
 /// </code>
 /// </example>
 /// <param name="eid">The event ID.</param>
 /// <param name="rsvp_Status">The user's RSVP status. Specify attending, unsure, or declined.</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 successful.</returns>
 public void RsvpAsync(long eid, string rsvp_Status, RsvpCallback callback, Object state)
 {
     Rsvp(eid, rsvp_Status, true, callback, state);
 }
 /// <summary>
 /// Sets the attendance option for the current user.
 /// </summary>
 /// <example>
 /// <code>
 /// private static void RunDemoAsync()
 /// {
 ///     Api api = new Api(new DesktopSession(Constants.ApplicationKey, Constants.ApplicationSecret, Constants.ApplicationSecret, Constants.SessionKey));
 ///     api.Events.RsvpAsync(Constants.EventId, "attending", AsyncDemoCompleted, null);
 /// }
 ///
 /// private static void AsyncDemoCompleted(bool result, Object state, FacebookException e)
 /// {
 ///     var actual = result;
 /// }
 /// </code>
 /// </example>
 /// <param name="eid">The event ID.</param>
 /// <param name="rsvp_Status">The user's RSVP status. Specify attending, unsure, or declined.</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 successful.</returns>
 public void RsvpAsync(long eid, string rsvp_Status, RsvpCallback callback, Object state)
 {
     Rsvp(eid, rsvp_Status, true, callback, state);
 }