Table of Contents

Class ScannerExtensions

Namespace
Loehnert.Lisrt.Scanner
Assembly
Loehnert.Lisrt.Scanner.dll

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 IScanner

Scanner.

cancellationToken CancellationToken

Cancellation token to cancel the operation.

timeoutInMilliseconds int

Timeout in milliseconds. Use Infinite(-1) for a infinite timeout.

Returns

string

The scanned code.

Exceptions

ArgumentNullException

Thrown when scanner is null.

ArgumentOutOfRangeException

Thrown whentimeoutInMilliseconds 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.