Ejemplo n.º 1
0
        public void SetScanHandler(System.Windows.Forms.Control cMainInvoker)
        {
            if (null != cMainInvoker)
            {
                cInvoker = cMainInvoker;
                // Now that we've got a connection to a barcode reading device, assign a
                // method for the DcdEvent.  A recurring request is used so that we will
                // continue to get barcode data until our dialog is closed.
                DcdRequestType reqType = (DcdRequestType)1 | DcdRequestType.PostRecurring;

                // Initialize event
                dcdEvent          = new DcdEvent(hPSC, reqType, cInvoker);
                dcdEvent.Scanned += new DcdScanned(dcdEvent_Scanned);
            }
        }
Ejemplo n.º 2
0
        public void InitScanner()
        {
            try
            {
                hDcd = new DcdHandle(DcdDeviceCap.Exists | DcdDeviceCap.Barcode);

                // Now that we've got a connection to a barcode reading device, assign a
                // method for the DcdEvent.  A recurring request is used so that we will
                // continue to get barcode data until our dialog is closed.
                DcdRequestType reqType = (DcdRequestType)1 | DcdRequestType.PostRecurring;

                // Initialize event
                dcdEvent          = new DcdEvent(hDcd, reqType);
                dcdEvent.Scanned += new DcdScanned(dcdEvent_Scanned);
                Log.Info("Barcode scanner detected.", "Scan");
            }
            catch (Exception ex)
            {
                TerminalException ex2 = new TerminalException("Barcode scanner not detected.", ex);
                Log.Exception(ex2);
            }
        }