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