Table of Contents

Interface IBarCodeScannersService

Namespace
Acuit.Pinpoint.Workstation
Assembly
Acuit.Pinpoint.Workstation.Interfaces.dll

A service for monitoring bar code scans and intelligently routing them to clients.

public interface IBarCodeScannersService

Remarks

This service hides details about the bar code scanners from clients, simply providing the content of scanned bar codes.

Bar code scans are routed to clients that have attached handlers using the following logic:

  1. Handlers are sorted first by priority, and then by the order in which they were added.
  2. Each handler is called in turn, skipping any handlers associated with UIElement targets that are currently inactive (see below).
  3. As soon as a handler is called that sets Handled to true, routing is stopped and no more handlers are called.

A UIElement target is considered active only if all of the following are true:

  • It is visible.
  • It is enabled.
  • It belongs to the active window or dialog box.
  • No message box is being shown.

Methods

AddBarCodeScanHandler(UIElement, EventHandler<BarCodeScanEventArgs>)

Adds a handler for bar code scan events.

void AddBarCodeScanHandler(UIElement element, EventHandler<BarCodeScanEventArgs> handler)

Parameters

element UIElement

An optional UIElement that is considered the target for this event. If this is not null, then the handler will be called only when the element is active (see IBarCodeScannersService remarks).

handler EventHandler<BarCodeScanEventArgs>

The event handler.

Remarks

The default priority of Normal will be used.

AddBarCodeScanHandler(UIElement, EventHandler<BarCodeScanEventArgs>, BarCodeScanPriority)

Adds a handler for bar code scan events.

void AddBarCodeScanHandler(UIElement element, EventHandler<BarCodeScanEventArgs> handler, BarCodeScanPriority priority)

Parameters

element UIElement

An optional UIElement that is considered the target for this event. If this is not null, then the handler will be called only when the element is active (see IBarCodeScannersService remarks).

handler EventHandler<BarCodeScanEventArgs>

The event handler.

priority BarCodeScanPriority

The event routing priority.

AddBarCodeScanWeakEventHandler(UIElement, EventHandler<BarCodeScanEventArgs>)

Adds a weak handler for bar code scan events.

void AddBarCodeScanWeakEventHandler(UIElement element, EventHandler<BarCodeScanEventArgs> handler)

Parameters

element UIElement

An optional UIElement that is considered the target for this event. If this is not null, then the handler will be called only when the element is active (see IBarCodeScannersService remarks).

handler EventHandler<BarCodeScanEventArgs>

The event handler.

Remarks

Weak event handlers cause the service to hold a weak reference to the handler, which can help avoid memory leaks. See https://docs.microsoft.com/en-us/dotnet/framework/wpf/advanced/weak-event-patterns for more information.

The default priority of Normal will be used.

AddBarCodeScanWeakEventHandler(UIElement, EventHandler<BarCodeScanEventArgs>, BarCodeScanPriority)

Adds a weak handler for bar code scan events.

void AddBarCodeScanWeakEventHandler(UIElement element, EventHandler<BarCodeScanEventArgs> handler, BarCodeScanPriority priority)

Parameters

element UIElement

An optional UIElement that is considered the target for this event. If this is not null, then the handler will be called only when the element is active (see IBarCodeScannersService remarks).

handler EventHandler<BarCodeScanEventArgs>

The event handler.

priority BarCodeScanPriority

The event routing priority.

Remarks

Weak event handlers cause the service to hold a weak reference to the handler, which can help avoid memory leaks. See https://docs.microsoft.com/en-us/dotnet/framework/wpf/advanced/weak-event-patterns for more information.

RemoveBarCodeScanHandler(UIElement, EventHandler<BarCodeScanEventArgs>)

Removes a handler for bar code scan events.

void RemoveBarCodeScanHandler(UIElement element, EventHandler<BarCodeScanEventArgs> handler)

Parameters

element UIElement

An optional UIElement that is considered the target for this event.

handler EventHandler<BarCodeScanEventArgs>

The event handler.

RemoveBarCodeScanWeakEventHandler(UIElement, EventHandler<BarCodeScanEventArgs>)

Removes a weak handler for bar code scan events.

void RemoveBarCodeScanWeakEventHandler(UIElement element, EventHandler<BarCodeScanEventArgs> handler)

Parameters

element UIElement

An optional UIElement that is considered the target for this event.

handler EventHandler<BarCodeScanEventArgs>

The event handler.

SubmitScan(BarCodeScanEventArgs)

Submits a bar code scan for processing.

void SubmitScan(BarCodeScanEventArgs e)

Parameters

e BarCodeScanEventArgs

The bar code scan event arguments.

Remarks

Bar code scans submitted via this method will result in exactly the same processing as if the bar code was scanned using an attached bar code scanner.

If this is called from the main application thread, the bar code scan will be processed synchronously. If this is called from any other thread, this will immediately return and the bar code scan will be processed asynchronously.

Exceptions

ArgumentNullException

e is null.