Exemplo n.º 1
0
        /// <summary>
        /// todoComment
        /// </summary>
        public static void StartStandaloneRemindersProcessing()
        {
            DateTime Tomorrow00hrs;
            TimeSpan InitialSleepTime;
            TimeSpan TwentyfourHrs;

            // Process the Reminders once immediately
            ProcessRemindersDelegate(null);

            // Set up the Delegate that will be passed to the Timer
            URemindersProcessor = new TRemindersProcessor(ProcessRemindersDelegate);

            /*
             * Calculate the Timer's time periods
             */

            // Calculate the DateTime of midnight of the following day
            Tomorrow00hrs = DateTime.Now.Date.AddDays(1);

            // TLogging.Log('Tomorrow00hrs.ToString: ' + Tomorrow00hrs.ToString);
            // Calculate the time that the Timer should sleep until it wakes up on
            // midnight of the following day.
            InitialSleepTime = Tomorrow00hrs.Subtract(DateTime.Now);

            // TLogging.Log('InitialSleepTime.ToString: ' + InitialSleepTime.ToString);
            // Create a TimeSpan that is 1 day (=24 hrs). This is the interval in which
            // following Timer wakeups will occur
            // = 1 day
            TwentyfourHrs = new TimeSpan(1, 0, 0, 0);

            // TLogging.Log('Tomorrow00hrs + TwentyfourHrs: ' + Tomorrow00hrs.AddTicks(TwentyfourHrs.Ticks).ToString);

            /*
             * Schedule the regular Reminders calls.
             * The Timer will execute the function 'ProcessRemindersDelegate' through
             * calling the URemindersProcessor Delegate in the specified time periods.
             */
            new System.Threading.Timer(new TimerCallback(URemindersProcessor), null, InitialSleepTime, TwentyfourHrs);
        }
Exemplo n.º 2
0
        /// <summary>
        /// todoComment
        /// </summary>
        public static void StartStandaloneRemindersProcessing()
        {
            DateTime Tomorrow00hrs;
            TimeSpan InitialSleepTime;
            TimeSpan TwentyfourHrs;

            // Process the Reminders once immediately
            ProcessRemindersDelegate(null);

            // Set up the Delegate that will be passed to the Timer
            URemindersProcessor = new TRemindersProcessor(ProcessRemindersDelegate);

            /*
             * Calculate the Timer's time periods
             */

            // Calculate the DateTime of midnight of the following day
            Tomorrow00hrs = DateTime.Now.Date.AddDays(1);

            // TLogging.Log('Tomorrow00hrs.ToString: ' + Tomorrow00hrs.ToString);
            // Calculate the time that the Timer should sleep until it wakes up on
            // midnight of the following day.
            InitialSleepTime = Tomorrow00hrs.Subtract(DateTime.Now);

            // TLogging.Log('InitialSleepTime.ToString: ' + InitialSleepTime.ToString);
            // Create a TimeSpan that is 1 day (=24 hrs). This is the interval in which
            // following Timer wakeups will occur
            // = 1 day
            TwentyfourHrs = new TimeSpan(1, 0, 0, 0);

            // TLogging.Log('Tomorrow00hrs + TwentyfourHrs: ' + Tomorrow00hrs.AddTicks(TwentyfourHrs.Ticks).ToString);

            /*
             * Schedule the regular Reminders calls.
             * The Timer will execute the function 'ProcessRemindersDelegate' through
             * calling the URemindersProcessor Delegate in the specified time periods.
             */
            new System.Threading.Timer(new TimerCallback(URemindersProcessor), null, InitialSleepTime, TwentyfourHrs);
        }