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
scanner
IScannerScanner.
cancellationToken
CancellationTokenCancellation token to cancel the operation.
timeoutInMilliseconds
intTimeout in milliseconds. Use Infinite(-1) for a infinite timeout.
Returns
- string
The scanned code.
Exceptions
- ArgumentNullException
Thrown when
scanner
is null.- ArgumentOutOfRangeException
Thrown when
timeoutInMilliseconds
is 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
timeoutInMilliseconds
has elapsed.- OperationCanceledException
Thrown when
cancellationToken
is canceled.