예제 #1
0
        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);
        }
예제 #2
0
파일: Heart.cs 프로젝트: johants/n2cms
        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(); };
        }
예제 #3
0
        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));
            }
        }
예제 #4
0
 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;
 }