Example #1
0
 //Runs when the mailtimer ticks.  Used for summary emails if sending emails are enabled
 /// <summary>
 /// If sending status emails are enabled, fires this method on decided interval
 /// </summary>
 /// <param name="source">Source object</param>
 /// <param name="e">ElapsedEventArgs object</param>
 public static void MailTimer_Tick(object source, ElapsedEventArgs e)
 {
     if (ConfigurationHelperLibrary.IsSendingEmailsAllowed())
     {
         //Do something if we have allowed sending emails through the configuration file
     }
 }
Example #2
0
        /// <summary>
        /// Occurs when the windows service is started
        /// </summary>
        /// <param name="args"></param>
        protected override void OnStart(string[] args)
        {
            //Create and start new thread for timer to allow program to wait for incoming files
            WorkerTimer = new Timer(ConfigurationHelperLibrary.cfgWorkerInterval);

            //Timer to control mailflow, default every 30 minutes
            Timer MailTimer = new Timer(ConfigurationHelperLibrary.cfgMailTimer);

            //Register events to listen for: Created only
            fameWatcher.Created += new FileSystemEventHandler(FameLibrary.OnFileDropped);

            //Check log messages at predefined intervals and send emails if necessary.
            MailTimer.Elapsed += new ElapsedEventHandler(ConfigurationHelperLibrary.MailTimer_Tick);


            //This begins the actual file monitoring
            ConfigurationHelperLibrary.ToggleMonitoring(true, fameWatcher);
            WorkerTimer.Start();
            MailTimer.Start();
        }
Example #3
0
 /// <summary>
 /// Occurs when windows is shutting down
 /// </summary>
 protected override void OnShutdown()
 {
     ConfigurationHelperLibrary.ToggleMonitoring(false, fameWatcher);
     MailTimer.Stop();
     WorkerTimer.Stop();
 }
Example #4
0
 /// <summary>
 /// Occurs when resuming the windows service from a paused state
 /// </summary>
 protected override void OnContinue()
 {
     ConfigurationHelperLibrary.ToggleMonitoring(true, fameWatcher);
     WorkerTimer.Start();
     MailTimer.Start();
 }