예제 #1
0
 // method to set the time when the timer should wake up to invoke the next schedule
 static void SetNextEventTime()
 {
     try
     {
         if (m_schedulesList.Count == 0)
         {
             m_timer.Change(Timeout.Infinite, Timeout.Infinite); // this will put the timer to sleep
             return;
         }
         m_nextSchedule = (Host.Schedule.Schedule)m_schedulesList[0];
         TimeSpan ts = m_nextSchedule.NextInvokeTime.Subtract(DateTime.Now);
         if (ts < TimeSpan.Zero)
             ts = TimeSpan.Zero; // cannot be negative !
         m_timer.Change((int)ts.TotalMilliseconds, Timeout.Infinite); // invoke after the timespan
     }
     catch
     { ;}
 }
예제 #2
0
 public void setSchedule(Schedule sch)
 {
     this.schedule=sch;
 }