コード例 #1
0
        public static FuncAsync <Operator, TParameter, TResult> ContinueWithAsync <TParameter, TResult>(IEnumerable <Operator> operators,
                                                                                                        Func <Operator, TParameter, TResult> func, TParameter parameter)
        {
            FuncAsync <Operator, TParameter, TResult> next = Invoke(WaitAll, operators).ContinueWithAsync(func, parameter);

            return(next);
        }
コード例 #2
0
        /// <summary>
        /// 异步调用方法
        /// 自动从线程池获取一个空闲线程去执行操作
        /// </summary>
        /// <param name="func"></param>
        /// <param name="parameter1"></param>
        /// <param name="parameter2"></param>
        public static FuncAsync <T1, T2, TResult> Invoke <T1, T2, TResult>(Func <T1, T2, TResult> func, T1 parameter1, T2 parameter2)
        {
            FuncAsync <T1, T2, TResult> @operator = new FuncAsync <T1, T2, TResult>(func, parameter1, parameter2);

            @operator.Invoke();
            return(@operator);
        }
コード例 #3
0
        /// <summary>
        /// 异步调用方法
        /// 自动从线程池获取一个空闲线程去去执行操作
        /// </summary>
        /// <param name="func"></param>
        public static FuncAsync <TResult> Invoke <TResult>(Func <TResult> func)
        {
            FuncAsync <TResult> @operator = new FuncAsync <TResult>(func);

            @operator.Invoke();
            return(@operator);
        }
コード例 #4
0
        public static FuncAsync <T1, T2, T3, T4, T5, T6, T7, T8, TResult> Invoke <T1, T2, T3, T4, T5, T6, T7, T8, TResult>(Func <T1, T2, T3, T4, T5, T6, T7, T8, TResult> func, T1 parameter1,
                                                                                                                           T2 parameter2, T3 parameter3, T4 parameter4, T5 parameter5, T6 parameter6, T7 parameter7, T8 parameter8)
        {
            FuncAsync <T1, T2, T3, T4, T5, T6, T7, T8, TResult> @operator = new FuncAsync <T1, T2, T3, T4, T5, T6, T7, T8, TResult>(func, parameter1, parameter2, parameter3,
                                                                                                                                    parameter4, parameter5, parameter6, parameter7, parameter8);

            @operator.Invoke();
            return(@operator);
        }
コード例 #5
0
        public static FuncAsync <TParameter, TResult> Invoke <TParameter, TResult>(Func <TParameter, TResult> func, TParameter parameter)
        {
            TParameter param = parameter;
            FuncAsync <TParameter, TResult> @operator = new FuncAsync <TParameter, TResult>(func, param);

            @operator.Invoke();

            return(@operator);
        }
コード例 #6
0
        public static FuncAsync <Operator, TParameter1, TParameter2, TParameter3, TParameter4, TResult> ContinueWithAsync
        <TParameter1, TParameter2, TParameter3, TParameter4, TResult>
            (IEnumerable <Operator> operators,
            Func <Operator, TParameter1, TParameter2, TParameter3, TParameter4, TResult> func,
            TParameter1 parameter1,
            TParameter2 parameter2,
            TParameter3 parameter3,
            TParameter4 parameter4)
        {
            FuncAsync <Operator, TParameter1, TParameter2, TParameter3, TParameter4, TResult> next =
                Invoke(WaitAll, operators)
                .ContinueWithAsync(func, parameter1, parameter2, parameter3, parameter4);

            return(next);
            //TODO:BUG CotinueWithAsync之后无法调用Wait等待
        }
コード例 #7
0
        /// <summary>
        /// 等待所有执行完成后继续执行
        /// </summary>
        /// <param name="func"></param>
        /// <param name="operators"></param>
        /// <returns></returns>
        public static FuncAsync <TResult> ContinueWithAsync <TResult>(IEnumerable <Operator> operators, Func <TResult> func)
        {
            FuncAsync <TResult> next = Invoke(WaitAll, operators).ContinueWithAsync(func);

            return(next);
        }