Exemple #1
0
        private void ProcessRequests(ResponseReceiver responseReciever)
        {
            var requestsToProcess = queuedRequests.ToArray();

            BeforeSendingRequests(requestsToProcess);

            var tempResponseArray = new Response[requestsToProcess.Length];
            var requestsToSend    = new List <Request>(requestsToProcess);

            GetCachedResponsesAndRemoveThoseRequests(requestsToProcess, tempResponseArray, requestsToSend);
            var requestsToSendAsArray = requestsToSend.ToArray();

            if (requestsToSendAsArray.Length > 0)
            {
                requestProcessor.ProcessRequestsAsync(requestsToSendAsArray,
                                                      a => OnProcessRequestsCompleted(a, responseReciever, tempResponseArray, requestsToSendAsArray));
            }
            else
            {
                var synchronizationContext = SynchronizationContext.Current ?? new SynchronizationContext();
                synchronizationContext.Post(s => OnProcessRequestsCompleted(null, responseReciever, tempResponseArray, requestsToSendAsArray), null);
            }

            AfterSendingRequests(requestsToProcess);
        }
 private void ProcessRequests(ResponseReceiver responseReceiver)
 {
     this.responseReceiver = responseReceiver;
 }
Exemple #3
0
 public virtual void OnProcessRequestsCompleted(ProcessRequestsAsyncCompletedArgs args, ResponseReceiver responseReciever,
                                                Response[] tempResponseArray, Request[] requestsToSendAsArray)
 {
     Dispose();
     responseReciever.ReceiveResponses(args, tempResponseArray, requestsToSendAsArray);
 }