Пример #1
0
        /// <summary>
        /// Sets the timed trigger extension of the module to the due time
        /// of the given message.
        /// </summary>
        /// <param name="message">
        /// See above.
        /// </param>
        private void SetTimedTriggerForMessage(ScheduledMessage message)
        {
            // The time in ms we have to wait until the next
            // scheduled message has to be posted.
            int nextMessageWaitTime = (message.DueTime - DateTime.Now).Milliseconds;

            // If the message is to late, schedule it immediately.
            if (nextMessageWaitTime < 0)
            {
                nextMessageWaitTime = 0;
            }

            // Set the timed trigger.
            moduleController.Extensions.Get <TimedTriggerExtension>().ChangeTimer(nextMessageWaitTime, Timeout.Infinite);
        }
Пример #2
0
 /// <summary>
 /// Compares the due times of the message.
 /// </summary>
 /// <param name="messageA">
 /// Left side of comparison.
 /// </param>
 /// <param name="messageB">
 /// Right side of comparison.
 /// </param>
 /// <returns>
 /// Result of dueTimeA.CompareTo(dueTimeB);
 /// </returns>
 private int CompareDueTimeOfScheduledMessage(ScheduledMessage messageA, ScheduledMessage messageB)
 {
     return(messageA.DueTime.CompareTo(messageB.DueTime));
 }
Пример #3
0
 public void ConsumeScheduledMessage(ScheduledMessage message)
 {
     scheduledMessages.Add(message);
     scheduledMessages.Sort(CompareDueTimeOfScheduledMessage);
     SetTimedTriggerForMessage(scheduledMessages[0]);
 }
Пример #4
0
        /// <summary>
        /// Sets the timed trigger extension of the module to the due time 
        /// of the given message.
        /// </summary>
        /// <param name="message">
        /// See above.
        /// </param>
        private void SetTimedTriggerForMessage(ScheduledMessage message)
        {
            // The time in ms we have to wait until the next 
            // scheduled message has to be posted.
            int nextMessageWaitTime = (message.DueTime - DateTime.Now).Milliseconds;

            // If the message is to late, schedule it immediately.
            if (nextMessageWaitTime < 0)
            {
                nextMessageWaitTime = 0;
            }

            // Set the timed trigger.
            moduleController.Extensions.Get<TimedTriggerExtension>().ChangeTimer(nextMessageWaitTime, Timeout.Infinite);
        }
Пример #5
0
 /// <summary>
 /// Compares the due times of the message.
 /// </summary>
 /// <param name="messageA">
 /// Left side of comparison.
 /// </param>
 /// <param name="messageB">
 /// Right side of comparison.
 /// </param>
 /// <returns>
 /// Result of dueTimeA.CompareTo(dueTimeB);
 /// </returns>
 private int CompareDueTimeOfScheduledMessage(ScheduledMessage messageA, ScheduledMessage messageB)
 {
     return messageA.DueTime.CompareTo(messageB.DueTime);
 }
Пример #6
0
 public void ConsumeScheduledMessage(ScheduledMessage message)
 {
     scheduledMessages.Add(message);
     scheduledMessages.Sort(CompareDueTimeOfScheduledMessage);
     SetTimedTriggerForMessage(scheduledMessages[0]);
 }