コード例 #1
0
ファイル: Job.cs プロジェクト: arargame/automatmachine
        public virtual Job Run()
        {
            Invoke();

            if (ContinueWith != null)
            {
                Task.Run(() => ContinueWith.RunAsync());
            }

            return(this);
        }
コード例 #2
0
ファイル: Job.cs プロジェクト: arargame/automatmachine
        public virtual async Task <Job> RunAsync()
        {
            var task = new Task <Job>(new Func <Job>(Invoke));

            task.Start();

            if (ContinueWith != null)
            {
                await task.ContinueWith(t => ContinueWith.RunAsync());
            }


            //if (JobState==AutomatMachine.JobState.Successful && !IsContinuous)
            //{
            //    return this;
            //}

            //if (Action != null)
            //{
            //    var task = new Task(Action);

            //    LastWorkDate = DateTime.Now;

            //    NextWorkDate = DateTime.Now.AddMilliseconds(Interval);

            //    task.Start();

            //    if (ContinueWith != null)
            //        await task.ContinueWith(t => ContinueWith.RunAsync());

            //    await task;

            //    NumberOfWorking++;
            //}

            await task;

            return(this);
        }