Пример #1
0
 public ISequenceSpecification First <T>() where  T : IStartupTask
 {
     lastTask = new TaskExecutionParameters {
         TaskType = typeof(T)
     };
     Sequence.Insert(0, lastTask);
     return(this);
 }
Пример #2
0
 public ISequenceSpecification Then <T>() where  T : IStartupTask
 {
     lastTask = new TaskExecutionParameters {
         TaskType = typeof(T)
     };
     Sequence.Add(lastTask);
     return(this);
 }
Пример #3
0
        private static void Reset(TaskExecutionParameters taskExecutionParameters, TaskGroup group)
        {
            var logEntry = new ExecutionLogEntry
            {
                Timestamp           = DateTime.Now,
                TaskName            = "-" + taskExecutionParameters.Task.GetType().Name,
                Group               = taskExecutionParameters.Group,
                SequencePosition    = taskExecutionParameters.Position,
                DelayInMilliseconds = 0,
                StartedAt           = DateTime.Now
            };

            taskExecutionParameters.Task.Reset();
            logEntry.EndedAt = DateTime.Now;
            group.ExecutionLog.Add(logEntry);
        }
Пример #4
0
        private static void Run(TaskExecutionParameters taskExecutionParameters, TaskGroup group)
        {
            var logEntry = new ExecutionLogEntry
            {
                Timestamp           = DateTime.Now,
                TaskName            = "+" + taskExecutionParameters.Task.GetType().Name,
                Group               = taskExecutionParameters.Group,
                SequencePosition    = taskExecutionParameters.Position,
                DelayInMilliseconds = taskExecutionParameters.Delay
            };

            if (taskExecutionParameters.Delay > 0)
            {
                Thread.Sleep(taskExecutionParameters.Delay);
            }
            logEntry.StartedAt = DateTime.Now;
            taskExecutionParameters.Task.Run();
            logEntry.EndedAt = DateTime.Now;
            group.ExecutionLog.Add(logEntry);
        }
Пример #5
0
 public SequenceSpecification()
 {
     lastTask = null;
     Sequence = new List <TaskExecutionParameters>();
 }