Example #1
0
        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));
        }
Example #2
0
 public void Dispose()
 {
     ConsolePrinter.WriteLine("RealBarcodeScanner disposed", ConsoleColor.DarkRed);
     _subscription.Dispose();
 }
Example #3
0
 public void Dispose()
 {
     ConsolePrinter.WriteLine("Scanner disposed", ConsoleColor.Red);
 }