Ejemplo n.º 1
0
        public ScheduledJob(string name, ScheduleTemplate schedule, Action action, DateTime startDate)
        {
            Name        = name;
            Description = schedule.ToString();
            Action      = action;
            Status      = JobStatus.Active;

            _ScheduleInstance = new ScheduleInstance(schedule, startDate);
        }
Ejemplo n.º 2
0
        public void AddJob(string name, Action action, ScheduleTemplate template, DateTime startDate)
        {
            var job = new ScheduledJob(name, template, action, startDate);

            if (!_ScheduledJobs.TryAdd(name, job))
            {
                throw new ArgumentException("A job with that name already exists");
            }

            job.GetFirstRunTime(DateTime.Now);

            if (Running)
            {
                _Timer.Change(0, Timeout.Infinite);
            }
        }
 public ScheduleInstance(ScheduleTemplate template, DateTime start)
 {
     _Template = template;
     _Start    = start;
 }