public LogViewModel( IBucket bucket, IStringRing ringBuffer, ILogWatcher logWatcher) : base(bucket) { _ringBuffer = ringBuffer ?? throw new ArgumentNullException(nameof(ringBuffer)); _logWatcher = logWatcher ?? throw new ArgumentNullException(nameof(logWatcher)); bucket.Name = Label; In = _ringBuffer.In; _ringBuffer.Size = BufferSize; _logWatcher.SynchronizationContext = SynchronizationContext.Current; _logWatcher.HtmlDecoderEnabled = true; _logWatcher.Line += In; _logWatcher.Line += (o, e) => { Out?.Invoke(o, e); }; }
public Bucket( IStringRing ringBuffer, IFilter filter, IToaster toaster, IDeduper deduper, IAudioAlert audioAlert ) { Buffer = ringBuffer ?? throw new ArgumentNullException(nameof(ringBuffer)); Filter = filter ?? throw new ArgumentNullException(nameof(filter)); _toaster = toaster ?? throw new ArgumentNullException(nameof(toaster)); _deduper = deduper ?? throw new ArgumentNullException(nameof(deduper)); _audioAlert = audioAlert ?? throw new ArgumentNullException(nameof(audioAlert)); _deduper.Items = Buffer.Items; _deduper.Selector = (_) => { return(_?.Substring(21)); }; //chop off the timestamp Filter.PropertyChanged += (o, e) => { Buffer.Clear(); }; _toaster.Passthrough = _audioAlert.Passthrough = true; Name = DefaultName; Size = DefaultSize; Dedupe = true; }