Example #1
0
        public void ThreadRun()
        {
            _scheduleTicker.TimerStart();

            while (WaitHandle.WaitAny(_queueEvents) != 0)
            {
                while (WaitHandle.WaitAny(_tickerEvents) != 0)
                {
                    FolderWatcherQueueItem item = _fileQueue.DequeueSyncConditional(ShouldProcess);

                    if (item != null)
                    {
                        _taskFactory.ProcessItem(item.Path);
                    }
                }
            }

            _scheduleTicker.TimerStop();
        }
Example #2
0
 private bool ShouldProcess(FolderWatcherQueueItem item)
 {
     Debug.Assert(item.Time != null, "item.Time != null");
     return(DateTime.Now.Subtract(item.Time.Value) > _taskDelay);
 }