private void OnDisplayUpdatesTimerEvent(object sender, ElapsedEventArgs e)
        {
            // only add another watched folder if we still have iterations.
            --_iterations;
            if (_iterations <= 0)
            {
                Stop();

                lock (_filesWaitingToAdd)
                {
                    foreach (var fullName in _filesWaitingToAdd)
                    {
                        _nonQuietOutput.AddErrorMessage(DateTime.UtcNow, $"Found added file that was not picked up! {fullName}", CancellationToken.None);
                    }
                }

                lock (_filesWaitingToRemove)
                {
                    foreach (var fullName in _filesWaitingToRemove)
                    {
                        _nonQuietOutput.AddErrorMessage(DateTime.UtcNow, $"Found removed file that was not picked up! {fullName}", CancellationToken.None);
                    }
                }
                _nonQuietOutput.AddMessage("All done!", CancellationToken.None);
                return;
            }

            AddAFile();
            RemoveAFile();
        }
Example #2
0
 private Task OnErrorAsync(IEventError ee, CancellationToken token)
 {
     _output.AddErrorMessage(ee.DateTimeUtc, $"[!]:{ee.Message}", token);
     return(Task.CompletedTask);
 }