Class ScannerExtensions
Provides a set of static methods for objects that implement IScanner.
public static class ScannerExtensions
- Inheritance
-
ScannerExtensions
- Inherited Members
Methods
WaitForCodeScanned(IScanner, CancellationToken, int)
Waits until a barcode is scanned.
public static string WaitForCodeScanned(this IScanner scanner, CancellationToken cancellationToken = default, int timeoutInMilliseconds = -1)
Parameters
scannerIScannerScanner.
cancellationTokenCancellationTokenCancellation token to cancel the operation.
timeoutInMillisecondsintTimeout in milliseconds. Use Infinite(-1) for a infinite timeout.
Returns
- string
The scanned code.
Exceptions
- ArgumentNullException
Thrown when
scanneris null.- ArgumentOutOfRangeException
Thrown when
timeoutInMillisecondsis a negative number other than -1 milliseconds, which represents an infinite time-out. -or- The number of milliseconds in timeout is greater than MaxValue.- TimeoutException
Thrown when
timeoutInMillisecondshas elapsed.- OperationCanceledException
Thrown when
cancellationTokenis canceled.