public Heart(Configuration.EngineSection config) { if (config.Scheduler.Interval < 1) { throw new ArgumentException("Cannot beat at a pace below 1 per second. Set engine.scheduler.interval to at least 1.", "config"); } timer = new Timer(config.Scheduler.Interval * 1000); }
public Heart(ConnectionMonitor connection, Configuration.EngineSection config) { if (config.Scheduler.Interval < 1) { throw new ArgumentException("Cannot beat at a pace below 1 per second. Set engine.scheduler.interval to at least 1.", "config"); } timer = new Timer(config.Scheduler.Interval * 1000); timer.Elapsed += new ElapsedEventHandler(timer_Elapsed); connection.Online += delegate { timer.Start(); }; connection.Offline += delegate { timer.Stop(); }; }
public Scheduler(IEngine engine, IHeart heart, IWorker worker, IWebContext context, IErrorNotifier errorHandler, ScheduledAction[] registeredActions, Configuration.EngineSection config) { this.engine = engine; this.heart = heart; this.worker = worker; this.context = context; this.errorHandler = errorHandler; this.enabled = config.Scheduler.Enabled; this.asyncActions = config.Scheduler.AsyncActions; this.runWhileDebuggerAttached = config.Scheduler.RunWhileDebuggerAttached; if (!string.IsNullOrEmpty(config.Scheduler.ExecuteOnMachineNamed)) { if (config.Scheduler.ExecuteOnMachineNamed != Environment.MachineName) { this.enabled = false; } } if (enabled) { actions = new List <ScheduledAction>(InstantiateActions(registeredActions, config.Scheduler)); } }
public DirectUrlInjector(IHost host, IUrlParser parser, IContentItemRepository repository, IDefinitionManager definitions, Configuration.EngineSection config) { this.host = host; this.parser = parser; this.repository = repository; this.definitions = definitions; this.enabled = config.DirectUrlInjector.Enabled; }