コード例 #1
0
 public ScheduledEvent(string id, DateTime time, ScheduledEventHandler handler)
 {
     this.id      = id;
     this.Handler = handler;
     timer        = new Timer(new TimerCallback(Callback), null, 10000, 0);
     NextCall     = time;
 }
コード例 #2
0
        public static string ScheduleEvent(DateTime time, ScheduledEventHandler handler)
        {
            string id;

            lock (map)
            {
                do
                {
                    id = random.Next(10000000, 100000000).ToString();
                } while (map[id] != null);
            }
            ScheduleEvent(id, time, handler);
            return(id);
        }
コード例 #3
0
 public static void ScheduleEvent(string id, DateTime time, ScheduledEventHandler handler)
 {
     lock (map)
     {
         ScheduledEvent ev = (ScheduledEvent)map[id];
         if (ev == null)
         {
             Debug.WriteLine("Scheduling event " + id + " for " + time.ToShortTimeString());
             ev = new ScheduledEvent(id, time, handler);
         }
         else
         {
             Debug.WriteLine("Rescheduling event " + id + " for " + time.ToShortTimeString());
             if (handler != null)
             {
                 ev.Handler = handler;
             }
             ev.NextCall = time;
         }
         map[id] = ev;
     }
 }
コード例 #4
0
ファイル: ActiveProperty.cs プロジェクト: cfo82/Magmageddon
 protected void scheduleOnce(double at, double delay, ScheduledEventHandler handler)
 {
     timeouts.Add(new Timeout(false, at + delay, handler));
 }
コード例 #5
0
ファイル: ActiveProperty.cs プロジェクト: cfo82/Magmageddon
 public Timeout(bool r, double t, ScheduledEventHandler h)
 {
     repeat    = r;
     timeoutAt = t;
     handler   = h;
 }