Exemplo n.º 1
0
        /// <summary>
        /// Executes the request asynchronously, and calls the specified delegate once done.
        /// </summary>
        /// <param name="responseHandler">The method to call once a response has been received.</param>
        public void ExecuteRequestAsync(Action <IAsyncRequestResult> responseHandler)
        {
            // Validate the input.
            var validator = new MethodValidator(Method, Parameters);

            if (validator.ValidateAllParameters() == false)
            {
                throw new InvalidOperationException("Request parameter validation failed for [" + this + "]");
            }

            // Begin a new request and when it is completed being assembled, execute it asynchronously.
            CreateWebRequest((request) =>
            {
                // When the request is completed constructing, execute it.
                var state = new AsyncExecutionState()
                {
                    ResponseHandler = responseHandler,
                    Try             = 1,
                    WaitTime        = RetryInitialWaitTime,
                    CurrentRequest  = request
                };
                InternalBeginExecuteRequest(state);
            });
        }
Exemplo n.º 2
0
        /// <summary>
        /// Executes the request asynchronously, and calls the specified delegate once done.
        /// </summary>
        /// <param name="responseHandler">The method to call once a response has been received.</param>
        public void ExecuteRequestAsync(Action<IAsyncRequestResult> responseHandler)
        {
            // Validate the input.
            var validator = new MethodValidator(Method, Parameters);
            if (validator.ValidateAllParameters() == false)
            {
                throw new InvalidOperationException("Request parameter validation failed for [" + this + "]");
            }

            InternalBeginExecuteRequest(new AsyncExecutionState
                                        {
                                            ResponseHandler = responseHandler,
                                            Try = 1,
                                            WaitTime = RetryInitialWaitTime,
                                            CurrentRequest =  CreateWebRequest()
                                        });
        }
Exemplo n.º 3
0
        /// <summary>
        /// Executes the request asynchronously, and calls the specified delegate once done.
        /// </summary>
        /// <param name="responseHandler">The method to call once a response has been received.</param>
        public void ExecuteRequestAsync(Action<IAsyncRequestResult> responseHandler)
        {
            // Validate the input.
            var validator = new MethodValidator(Method, Parameters);
            if (validator.ValidateAllParameters() == false)
            {
                throw new InvalidOperationException("Request parameter validation failed for [" + this + "]");
            }

            // Begin a new request and when it is completed being assembled, execute it asynchronously.
            CreateWebRequest((request) =>
            {
                // When the request is completed constructing, execute it.
                var state = new AsyncExecutionState()
                {
                    ResponseHandler = responseHandler,
                    Try = 1,
                    WaitTime = RetryInitialWaitTime,
                    CurrentRequest = request
                };
                InternalBeginExecuteRequest(state);
            });
        }