/// <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); }); }
/// <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() }); }
/// <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); }); }