Example #1
0
        protected override void OnStop()
        {
            WriteToFile("Service is stopped at " + DateTime.Now);

            //unencrypt the config file connection strings when the service stops
            EncryptConfigurationFile.UnencryptConfigFile();

            base.OnStop();
        }
Example #2
0
        protected override void OnStart(string[] args)
        {
            //encrypt the config file connection strings when the service starts

            EncryptConfigurationFile.EncryptConfigFile();

            WriteToFile("Service is started at " + DateTime.Now);
            timer.Enabled  = true;
            timer.Interval = scheduleTime.Subtract(DateTime.Now).TotalSeconds * 1000;
            timer.Elapsed += new System.Timers.ElapsedEventHandler(onElapsedTimer);

            base.OnStart(args);
        }