//Our GeneratorManager event. protected virtual void OnNumberGenerated(BatchAndNumberInput inputDetails, BatchAndNumber batchAndNumber) { NumberGenerated?.Invoke(this, new BatchAndNumberEventArgs() { BatchAndNumber = batchAndNumber, BatchAndNumberInput = inputDetails }); }
protected void OnNumberGenerated(object o) { if (_counter == _maxNumbersToGenerate) { _timer.Change(Timeout.Infinite, Timeout.Infinite); } var n = GenerateNumber(); Interlocked.Increment(ref _counter); NumberGenerated?.Invoke(n); }