protected void PrintIterationInfo(string message) { if (OnIterationFinished != null) { OnIterationFinished.Invoke(message); } }
private void ProcessItems() { Task.Run(async() => { while (!_disposed) { _resetEventSlim.Wait(); var emptyIteration = true; while (!_disposed && TryDequeue(out var factoryFunc)) { OnIterationStarted?.Invoke(); _pauseEventSlim.Wait(); await ExecuteCommand(factoryFunc); emptyIteration = false; } _resetEventSlim.Reset(); Logger.WriteLine(GetType(), $"Iteration finished. Empty: {emptyIteration}"); if (!emptyIteration) { OnIterationFinished?.Invoke(); } } }, _cancellationTokenSource.Token); }
protected void RaiseIterationFinishedEvent(IterationResult result) { OnIterationFinished?.Invoke(result); }