Exemplo n.º 1
0
 static void RetryTimer_Elapsed(object sender, ElapsedEventArgs e)
 {
     RetryWatch[] queue;
     lock (RetryQueue) {
         queue = RetryQueue.Values.ToArray();
     }
     queue = queue.Where(rw => DoRetry(rw)).ToArray();
     lock (RetryQueue) {
         foreach (RetryWatch resolved in queue)
         {
             RetryQueue.Remove(resolved.eventArgs);
         }
     }
 }
Exemplo n.º 2
0
 static void Retry(FileSystemEventArgs e, FileSystemWatcher sender)
 {
     lock (RetryQueue) {
         if (RetryQueue.ContainsKey(e))
         {
             RetryQueue[e].retries--;
             if (RetryQueue[e].retries <= 0)
             {
                 RetryQueue.Remove(e);
             }
         }
         else
         {
             RetryQueue.Add(e, new RetryWatch(sender, e));
         }
     }
     RetryTimer.Enabled = true;
 }