Example #1
0
 private void minuteTimer_Elapsed(object sender, ElapsedEventArgs e)
 {
     StopTimers(); //For stability, minute-timer events will stop second-timer as well.
     try {
         ServiceLogic.SyncDataAtMinute();
     }
     catch (Exception ex) {
         log.Error("Failed with exception.", ex);
         if (--maxFailure <= 0)
         {
             log.Warn("The maximum number of failures is reached.");
             OnStop();
         }
     }
     StartTimers();
 }
Example #2
0
 private void secondTimer_Elapsed(object sender, ElapsedEventArgs e)
 {
     secondTimer.Enabled = false;
     try {
         ServiceLogic.SyncDataAtSecond();
     }
     catch (Exception ex) {
         log.Error("Failed with exception.", ex);
         if (--maxFailure <= 0)
         {
             log.Warn("The maximum number of failures is reached.");
             Stop();
             return;
         }
     }
     secondTimer.Enabled = true;
 }