Beispiel #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);
        }
Beispiel #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));
 }
Beispiel #3
0
 public void ConsumeScheduledMessage(ScheduledMessage message)
 {
     scheduledMessages.Add(message);
     scheduledMessages.Sort(CompareDueTimeOfScheduledMessage);
     SetTimedTriggerForMessage(scheduledMessages[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);
        }
 /// <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);
 }
 public void ConsumeScheduledMessage(ScheduledMessage message)
 {
     scheduledMessages.Add(message);
     scheduledMessages.Sort(CompareDueTimeOfScheduledMessage);
     SetTimedTriggerForMessage(scheduledMessages[0]);
 }