Exemple #1
0
        public virtual Job Run()
        {
            Invoke();

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

            return(this);
        }
Exemple #2
0
        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);
        }