コード例 #1
0
        // Token: 0x06004183 RID: 16771 RVA: 0x000F3AB4 File Offset: 0x000F1CB4
        public static IAsyncResult Begin(Task task, AsyncCallback callback, object state)
        {
            IAsyncResult asyncResult;

            if (task.IsCompleted)
            {
                asyncResult = new TaskToApm.TaskWrapperAsyncResult(task, state, true);
                if (callback != null)
                {
                    callback(asyncResult);
                }
            }
            else
            {
                IAsyncResult asyncResult3;
                if (task.AsyncState != state)
                {
                    IAsyncResult asyncResult2 = new TaskToApm.TaskWrapperAsyncResult(task, state, false);
                    asyncResult3 = asyncResult2;
                }
                else
                {
                    asyncResult3 = task;
                }
                asyncResult = asyncResult3;
                if (callback != null)
                {
                    TaskToApm.InvokeCallbackWhenTaskCompletes(task, callback, asyncResult);
                }
            }
            return(asyncResult);
        }
コード例 #2
0
        public static TResult End <TResult>(IAsyncResult asyncResult)
        {
            TaskToApm.TaskWrapperAsyncResult wrapperAsyncResult = asyncResult as TaskToApm.TaskWrapperAsyncResult;
            Task <TResult> task = wrapperAsyncResult == null ? asyncResult as Task <TResult> : wrapperAsyncResult.Task as Task <TResult>;

            if (task == null)
            {
                __Error.WrongAsyncResult();
            }
            return(task.GetAwaiter().GetResult());
        }
コード例 #3
0
        public static void End(IAsyncResult asyncResult)
        {
            TaskToApm.TaskWrapperAsyncResult wrapperAsyncResult = asyncResult as TaskToApm.TaskWrapperAsyncResult;
            Task task = wrapperAsyncResult == null ? asyncResult as Task : wrapperAsyncResult.Task;

            if (task == null)
            {
                __Error.WrongAsyncResult();
            }
            task.GetAwaiter().GetResult();
        }
コード例 #4
0
        // Token: 0x06004185 RID: 16773 RVA: 0x000F3B44 File Offset: 0x000F1D44
        public static TResult End <TResult>(IAsyncResult asyncResult)
        {
            TaskToApm.TaskWrapperAsyncResult taskWrapperAsyncResult = asyncResult as TaskToApm.TaskWrapperAsyncResult;
            Task <TResult> task;

            if (taskWrapperAsyncResult != null)
            {
                task = (taskWrapperAsyncResult.Task as Task <TResult>);
            }
            else
            {
                task = (asyncResult as Task <TResult>);
            }
            if (task == null)
            {
                __Error.WrongAsyncResult();
            }
            return(task.GetAwaiter().GetResult());
        }
コード例 #5
0
        // Token: 0x06004184 RID: 16772 RVA: 0x000F3B04 File Offset: 0x000F1D04
        public static void End(IAsyncResult asyncResult)
        {
            TaskToApm.TaskWrapperAsyncResult taskWrapperAsyncResult = asyncResult as TaskToApm.TaskWrapperAsyncResult;
            Task task;

            if (taskWrapperAsyncResult != null)
            {
                task = taskWrapperAsyncResult.Task;
            }
            else
            {
                task = (asyncResult as Task);
            }
            if (task == null)
            {
                __Error.WrongAsyncResult();
            }
            task.GetAwaiter().GetResult();
        }