public void ExecuteAsync(Action <IClientHttpResponseAsyncContext> executeCompleted) { if (executeCompleted != null) { this.executeCompletedDelegates.Insert(0, executeCompleted); } if (enumerator.MoveNext()) { if (enumerator.Current is IClientHttpRequestAsyncInterceptor) { ((IClientHttpRequestAsyncInterceptor)enumerator.Current).ExecuteAsync(this); } else { if (enumerator.Current is IClientHttpRequestBeforeInterceptor) { ((IClientHttpRequestBeforeInterceptor)enumerator.Current).BeforeExecute(this); } this.ExecuteAsync(null); } } else { this.delegateRequest.ExecuteAsync(this.asyncState, delegate(ClientHttpRequestCompletedEventArgs args) { ResponseAsyncContext responseAsyncContext = new ResponseAsyncContext(args); foreach (Action <IClientHttpResponseAsyncContext> action in this.executeCompletedDelegates) { action(responseAsyncContext); } if (this.interceptedExecuteCompleted != null) { interceptedExecuteCompleted(responseAsyncContext.GetCompletedEventArgs()); } }); } }
public void ExecuteAsync(Action<IClientHttpResponseAsyncContext> executeCompleted) { if (executeCompleted != null) { this.executeCompletedDelegates.Insert(0, executeCompleted); } if (enumerator.MoveNext()) { if (enumerator.Current is IClientHttpRequestAsyncInterceptor) { ((IClientHttpRequestAsyncInterceptor)enumerator.Current).ExecuteAsync(this); } else { if (enumerator.Current is IClientHttpRequestBeforeInterceptor) { ((IClientHttpRequestBeforeInterceptor)enumerator.Current).BeforeExecute(this); } this.ExecuteAsync(null); } } else { this.delegateRequest.ExecuteAsync(this.asyncState, delegate(ClientHttpRequestCompletedEventArgs args) { ResponseAsyncContext responseAsyncContext = new ResponseAsyncContext(args); foreach (Action<IClientHttpResponseAsyncContext> action in this.executeCompletedDelegates) { action(responseAsyncContext); } if (this.interceptedExecuteCompleted != null) { interceptedExecuteCompleted(responseAsyncContext.GetCompletedEventArgs()); } }); } }