コード例 #1
0
        protected override void OnStart(string[] args)
        {
            string nonAggregatedUserVersionInfoPath = System.Configuration.ConfigurationSettings.AppSettings["nonAggregatedUserVersionInfoPath"];
            string aggregatedserVersionInfoPath     = System.Configuration.ConfigurationSettings.AppSettings["aggregatedUserVersionInfoPath"];
            int    approxMaxNoRows = int.Parse(System.Configuration.ConfigurationSettings.AppSettings["approxMaxNoRows"]);
            int    timerInterval   = int.Parse(System.Configuration.ConfigurationSettings.AppSettings["timerInterval"]) * 60 * 1000;

            _simpleAggregator = new SimpleAggregator(nonAggregatedUserVersionInfoPath, aggregatedserVersionInfoPath, "user_version_info", approxMaxNoRows, typeof(ComponentInfoCollection));

            _timer.Interval = timerInterval;

            _timer.Start();

            eventLog.WriteEntry("Service has started");
        }
コード例 #2
0
 protected override void OnStop()
 {
     _timer.Stop();
     _simpleAggregator = null;
     eventLog.WriteEntry("Service has stopped");
 }