コード例 #1
0
 public AsyncStep(
     BeginCall beginCall,
     EndCall endCall,
     Call call,
     ExceptionPolicy policy)
 {
     this.policy    = policy;
     this.beginCall = beginCall;
     this.endCall   = endCall;
     this.call      = call;
 }
コード例 #2
0
            public ParallelAsyncResult(TIteratorAsyncResult iteratorAsyncResult, ICollection <TWorkItem> workItems, BeginCall <TWorkItem> beginCall, EndCall <TWorkItem> endCall, TimeSpan timeout, AsyncCallback callback, object state)
                : base(callback, state)
            {
                this.iteratorAsyncResult = iteratorAsyncResult;
                this.workItems           = workItems;
                this.endCall             = endCall;
                this.actions             = this.workItems.Count + 1;

                foreach (TWorkItem source in workItems)
                {
                    try
                    {
                        beginCall(iteratorAsyncResult, source, timeout, completed, new CallbackState(this, source));
                    }
                    catch (Exception e)
                    {
                        TryComplete(e, true);
                    }
                }

                TryComplete(null, true);
            }
コード例 #3
0
 protected AsyncStep CallAsync(BeginCall beginCall, EndCall endCall, ExceptionPolicy policy)
 {
     return(new AsyncStep(beginCall, endCall, null, policy));
 }
コード例 #4
0
 protected AsyncStep CallParallelAsync <TWorkItem>(ICollection <TWorkItem> workItems, BeginCall <TWorkItem> beginCall, EndCall <TWorkItem> endCall, TimeSpan timeout, ExceptionPolicy policy)
 {
     return(this.CallAsync(
                (thisPtr, t, c, s) => new ParallelAsyncResult <TWorkItem>(thisPtr, workItems, beginCall, endCall, timeout, c, s),
                (thisPtr, r) => ParallelAsyncResult <TWorkItem> .End(r),
                policy));
 }
コード例 #5
0
 public static AsyncStep CallParallel(BeginCall begin, EndCall end)
 {
     return(new AsyncStep(begin, end, true));
 }
コード例 #6
0
 public static AsyncStep CallParallel(BeginCall begin, EndCall end, IAsyncCatch[] catches)
 {
     return(new AsyncStep(begin, end, true, catches));
 }
コード例 #7
0
 public static AsyncStep CallAsync(BeginCall begin, EndCall end, IAsyncCatch[] catches)
 {
     return(new AsyncStep(begin, end, false, catches));
 }
コード例 #8
0
 public static AsyncStep CallAsync(BeginCall begin, EndCall end)
 {
     return(new AsyncStep(begin, end, false));
 }
コード例 #9
0
 public AsyncStep(BeginCall begin, EndCall end, bool isParallel, IAsyncCatch[] catches)
     : this(begin, end, isParallel)
 {
     this.Catches = catches;
 }
コード例 #10
0
 public AsyncStep(BeginCall begin, EndCall end, bool isParallel)
 {
     this.Begin      = begin;
     this.End        = end;
     this.IsParallel = isParallel;
 }
コード例 #11
0
 public void Call(int number)
 {
     BeginCall?.Invoke(this, new CallEventArgs(number));
 }