public IObservable <IList <string> > ListenToScanner(Func <string, bool> filterScans) { var scans = Observable .Using( () => _createResourceFactory(), realScanner => CreateObservableFactory(realScanner) ) .Select(@event => @event.EventArgs.Trim()) .Where(filterScans) .Distinct() .Do(scannedString => { ConsolePrinter.WriteLine($"Scanner produced {scannedString}", ConsoleColor.Red); }); var minimumScans = scans.Buffer(2); var maximumScans = scans.Buffer(3); return(minimumScans.Merge(maximumScans)); }
public void Dispose() { ConsolePrinter.WriteLine("RealBarcodeScanner disposed", ConsoleColor.DarkRed); _subscription.Dispose(); }
public void Dispose() { ConsolePrinter.WriteLine("Scanner disposed", ConsoleColor.Red); }