Exemplo n.º 1
0
        private bool Cancel(long eid, string cancelMessage, bool isAsync, CancelEventCallback callback, Object state)
        {
            var parameterList = new Dictionary <string, string> {
                { "method", "facebook.events.cancel" }
            };

            Utilities.AddRequiredParameter(parameterList, "eid", eid);
            Utilities.AddOptionalParameter(parameterList, "cancel_message", cancelMessage);

            if (isAsync)
            {
                SendRequestAsync <events_cancel_response, bool>(parameterList, !string.IsNullOrEmpty(Session.SessionKey), new FacebookCallCompleted <bool>(callback), state);
                return(true);
            }

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

            return(response == null ? false : response.TypedValue);
        }
        private bool Cancel(long eid, string cancelMessage, bool isAsync, CancelEventCallback callback, Object state)
        {
            var parameterList = new Dictionary<string, string> { { "method", "facebook.events.cancel" } };
            Utilities.AddRequiredParameter(parameterList, "eid", eid);
            Utilities.AddOptionalParameter(parameterList, "cancel_message", cancelMessage);

            if (isAsync)
            {
                SendRequestAsync<events_cancel_response, bool>(parameterList, !string.IsNullOrEmpty(Session.SessionKey), new FacebookCallCompleted<bool>(callback), state);
                return true;
            }

            var response = SendRequest<events_cancel_response>(parameterList, !string.IsNullOrEmpty(Session.SessionKey));
            return response == null ? false : response.TypedValue;
        }
Exemplo n.º 3
0
 /// <summary>
 /// Cancels an event. The application must be an admin of the event.
 /// </summary>
 /// <example>
 /// <code>
 /// private static void RunDemoAsync()
 /// {
 ///     Api api = new Api(new DesktopSession(Constants.ApplicationKey, Constants.ApplicationSecret, Constants.ApplicationSecret, Constants.SessionKey));
 ///     api.Events.CancelAsync(Constants.EventId, "cancel message", 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="cancelMessage">The message sent explaining why the event was canceled. You can pass an empty string if you don't want to provide an explanation.</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 the Cancel is successful.</returns>
 public void CancelAsync(long eid, string cancelMessage, CancelEventCallback callback, Object state)
 {
     Cancel(eid, cancelMessage, true, callback, state);
 }
 /// <summary>
 /// Cancels an event. The application must be an admin of the event.
 /// </summary>
 /// <example>
 /// <code>
 /// private static void RunDemoAsync()
 /// {
 ///     Api api = new Api(new DesktopSession(Constants.ApplicationKey, Constants.ApplicationSecret, Constants.ApplicationSecret, Constants.SessionKey));
 ///     api.Events.CancelAsync(Constants.EventId, "cancel message", 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="cancelMessage">The message sent explaining why the event was canceled. You can pass an empty string if you don't want to provide an explanation.</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 the Cancel is successful.</returns>
 public void CancelAsync(long eid, string cancelMessage, CancelEventCallback callback, Object state)
 {
     Cancel(eid, cancelMessage, true, callback, state);
 }