0% found this document useful (0 votes)
9 views2 pages

MSR and Scanner Event Handling Guide

This document provides instructions for listening to MSR/scanner devices in AX Dynamics Retail. It explains how to subscribe to the device events in the form OnLoad event, add event handler methods to process scan and card data, and unsubscribe from the events in the OnFormClosed event. The form must handle keyboard wedge MSR and scanner events itself. The code sample assumes the 'Application' instance is accessible to the form.

Uploaded by

Islam Sultan
Copyright
© Attribution Non-Commercial (BY-NC)
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as DOCX, PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
9 views2 pages

MSR and Scanner Event Handling Guide

This document provides instructions for listening to MSR/scanner devices in AX Dynamics Retail. It explains how to subscribe to the device events in the form OnLoad event, add event handler methods to process scan and card data, and unsubscribe from the events in the OnFormClosed event. The form must handle keyboard wedge MSR and scanner events itself. The code sample assumes the 'Application' instance is accessible to the form.

Uploaded by

Islam Sultan
Copyright
© Attribution Non-Commercial (BY-NC)
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as DOCX, PDF, TXT or read online on Scribd

How to: Listen to the MSR / Scanner devices

Further reading
Microsoft Dynamics AX 2012 for Developers [AX 2012] SDK Download

Tutorial
AX Dynamics Retail allows partners to add custom froms that can listen to OPOS MSR or scanner dervice those are claimed by POS. In Form OnLoad event subscribe to the MSR/Scanner events:

using [Link]; protected override void OnLoad(EventArgs e) { if (![Link]) { IPeripherals peripherals = [Link]; [Link] += new ScannerMessageEventHandler(Scanner_Event); [Link](); [Link] += new MSRMessageEventHandler(MSR_Event); [Link](); } [Link](e); }

Add event handler methods:

private void Scanner_Event(IScanInfo scanInfo) { if (scanInfo) != null && ![Link]([Link])) { } } private void MSR_MSRMessageEvent(ICardInfo cardInfo) { if (cardInfo != null && ![Link]([Link])) { ... } }

In form OnClosed event unsubscribe to the events:

protected override void OnFormClosed(FormClosedEventArgs e) { if (![Link]) { IPeripherals peripherals = [Link]; [Link](); [Link] -= new MSRMessageEventHandler(MSR_Event); [Link](); [Link] -= new ScannerMessageEventHandler(Scanner_Event); } [Link](e); } }

Notes: 1. Form has to handle keyboard wedge MSR and Scanner events by them self. 2. Code sample assumed that Application instance is accesbile to the form.

You might also like