public void Register(int timeout, ITimerClient client)
 {
     if (stopwatch.Elapsed > TimeSpan.FromSeconds(timeout))
     {
         client.TimeOut();
     }
 }
Exemplo n.º 2
0
 public void Unsubscribe(ITimerClient timerClient)
 {
     if (clients.Count == 1)
     {
         timer.Stop();
     }
     clients.Remove(timerClient);
 }
Exemplo n.º 3
0
 public void Subscribe(ITimerClient timerClient)
 {
     clients.Add(timerClient);
     if (clients.Count == 1)
     {
         timer.Start();
     }
 }
 public void Register(int timeout, ITimerClient client)
 {
     _client = client;
     Task.Factory.StartNew(() =>
     {
         System.Threading.Thread.Sleep(timeout);
         TimeOut();
     });
 }
Exemplo n.º 5
0
        public void start_notifying(ITimerClient client_to_be_notified, TimeSpan span)
        {
            stop_notifying(client_to_be_notified);

            var timer = factory.create_for(span);
            timer.Elapsed += (sender, args) => client_to_be_notified.notify();
            timer.Start();
            timers[client_to_be_notified] = timer;
        }
 public void Register(int s, ITimerClient c)
 {
     _secunds = s;
 }
Exemplo n.º 7
0
 public void Unsubscribe(ITimerClient timerClient)
 {
     if (clients.Count == 1)
         timer.Stop();
     clients.Remove(timerClient);
 }
Exemplo n.º 8
0
 public void Subscribe(ITimerClient timerClient)
 {
     clients.Add(timerClient);
     if (clients.Count == 1)
         timer.Start();
 }
Exemplo n.º 9
0
 public void Register(int timeout, int timeOutId, ITimerClient timerClient)
 {
     /*
      * Code
      */
 }
Exemplo n.º 10
0
 public void stop_notifying(ITimerClient client_to_stop_notifying)
 {
     if (!timers.ContainsKey(client_to_stop_notifying)) return;
     timers[client_to_stop_notifying].Stop();
     timers[client_to_stop_notifying].Dispose();
 }
 public void Register(int timeout, ITimerClient client)
 {
     /* CODE */
 }
Exemplo n.º 12
0
 public void Register(int timeout, int timeoutId, ITimerClient client)
 {
     client.Timeout(timeoutId);
 }