/// <summary> /// Agent that runs a scheduled task /// </summary> /// <param name="task"> /// The invoked task /// </param> /// <remarks> /// This method is called when a periodic or resource intensive task is invoked /// </remarks> protected override void OnInvoke(ScheduledTask task) { try { //get the list of birthdays today and tomorrow GetRecentBirthdays(); AppLog.CleanUpLogFile(); } catch (Exception ex) { AppLog.WriteToLog(DateTime.Now, "Ërror in agent : " + ex.Message + ". Stack : " + ex.StackTrace, LogLevel.Error); } finally { NotifyComplete(); } }