Exemplo n.º 1
0
        public IStepBuilder StartWith(Action action = null)
        {
            Task task =
                action is null ? new Task(() => { })
                : new Task(action);
            var _stepBuilder = DependencyInjectionService.GetService <IStepBuilder>();

            _task.ConfigureAwait(false).GetAwaiter().OnCompleted(() => { task.Start(); });

            return(_stepBuilder);
        }
Exemplo n.º 2
0
        /// <summary>
        /// 并行 step
        /// </summary>
        /// <param name="action"></param>
        /// <returns></returns>
        public IStepBuilder Parallel(Action <IStepParallel> action, bool anyAwait = false)
        {
            IStepParallel parallel = anyAwait ? DependencyInjectionService.GetService <IStepParallelAny>() : DependencyInjectionService.GetService <IStepParallel>();
            Task          task     = new Task(() =>
            {
                action.Invoke(parallel);
            });

            _task.ConfigureAwait(false).GetAwaiter().OnCompleted(() =>
            {
                task.Start();
            });
            _task = task;
            return(this);
        }
Exemplo n.º 3
0
        public IStepBuilder StartWith(Action action = null)
        {
            if (action is null)
            {
                _task = new Task(() => { });
            }
            else
            {
                _task = new Task(action);
            }

            IStepBuilder _stepBuilder = DependencyInjectionService.GetService <IStepBuilder>();

            ((StepBuilder)_stepBuilder).SetTask(_task);
            return(_stepBuilder);
        }
Exemplo n.º 4
0
        /// <summary>
        /// 开始一个工作流
        /// </summary>
        public void Start()
        {
            IDoFlowBuilder builder = DependencyInjectionService.GetService <IDoFlowBuilder>();

            _flow.Build(builder).ThatTask.Start();
        }