示例#1
0
        private void _settings_Changed(object sender, EventArgs e)
        {
            log4net.Config.XmlConfigurator.ConfigureAndWatch(new FileInfo(_settings.Combine("log4net.config")));
            Apps.Settings = _settings.Renew <Settings>();
            _log.InfoFormat("settings: {0}", JsonMapper.ToJson(Apps.Settings));


            _log.Info(String.Format("Settings Changed {0} at {1}.", ServiceName, DateTime.Now));

            if (isStarting)
            {
                foreach (var worker in workers)
                {
                    worker.Cancel();
                }

                foreach (var task in Apps.Settings.Tasks)
                {
                    var worker = new TaskWorker(task);
                    workers.Add(worker);
                }
            }

            _log.Info(String.Format("Restarting {0} at {1}.", ServiceName, DateTime.Now));
        }
示例#2
0
        protected override void OnStart(string[] args)
        {
            isStarting = true;

            if (Environment.UserInteractive)
            {
                _log.Info("Press any key to stop the program.");
            }

            foreach (var task in Apps.Settings.Tasks)
            {
                var worker = new TaskWorker(task);
                workers.Add(worker);
            }
            _log.Info(String.Format("Starting {0} at {1}.", ServiceName, DateTime.Now));
        }
示例#3
0
        protected override void OnStart(string[] args)
        {
            isStarting = true;

            if (Environment.UserInteractive)
            {
                _log.Info("Press any key to stop the program.");
            }

            foreach (var task in Apps.Settings.Tasks)
            {
                var worker = new TaskWorker(task);
                workers.Add(worker);
            }
            _log.Info(String.Format("Starting {0} at {1}.", ServiceName, DateTime.Now));
        }
示例#4
0
        private void _settings_Changed(object sender, EventArgs e)
        {
            log4net.Config.XmlConfigurator.ConfigureAndWatch(new FileInfo(_settings.Combine("log4net.config")));
            Apps.Settings = _settings.Renew<Settings>();
            _log.InfoFormat("settings: {0}", JsonMapper.ToJson(Apps.Settings));

            _log.Info(String.Format("Settings Changed {0} at {1}.", ServiceName, DateTime.Now));

            if (isStarting)
            {
                foreach (var worker in workers)
                    worker.Cancel();

                foreach (var task in Apps.Settings.Tasks)
                {
                    var worker = new TaskWorker(task);
                    workers.Add(worker);
                }
            }

            _log.Info(String.Format("Restarting {0} at {1}.", ServiceName, DateTime.Now));
        }