Exemplo n.º 1
0
        void dcdEvent_Scanned(object sender, DcdEventArgs e)
        {
            string id = hDcd.ReadString(e.RequestID);

            id = id.Substring(0, id.Length - 1);
            if (isBusy)
            {
                return;
            }
            this.Invoke(delegateIdScanned, new object[] { id });
        }
Exemplo n.º 2
0
        /// <summary>
        /// Event that fires when a PSC scanner has performed a scan.
        /// </summary>
        private void dcdEvent_Scanned(object sender, DcdEventArgs e)
        {
            nCodeID  = CodeId.NoData;
            sBarCode = string.Empty;

            // Obtain the string and code id.
            try
            {
                sBarCode = hPSC.ReadString(e.RequestID, ref nCodeID);
            }
            catch (Exception)
            {
                //MessageBox.Show("Error reading string!");
            }

            OnBarcodeScan(new BarcodeScannerEventArgs((BCId)nCodeID, sBarCode));
            return;
        }
Exemplo n.º 3
0
        /// <summary>
        /// This method will be called when the DcdEvent is invoked.
        /// </summary>
        private void dcdEvent_Scanned(object sender, DcdEventArgs e)
        {
            if (App.ignoreScan || App.ScanHandler == null)
            {
                return;
            }
            CodeId cID     = CodeId.NoData;
            string dcdData = string.Empty;

            // Obtain the string and code id.
            try
            {
                dcdData = hDcd.ReadString(e.RequestID, ref cID);
                lock (scanQueue.SyncRoot)
                {
                    scanQueue.Enqueue(new ScanData(cID.ToString(), dcdData));
                }
            }
            catch (Exception ex)
            {
                Log.Exception(ex);
            }
        }
Exemplo n.º 4
0
        /// <summary>
        /// Другой поток: обработка события "Код сканирован" и переход к потоку данного окна
        /// </summary>
        void DcdEvent_Scanned(object sender, DcdEventArgs e)
        {
            try
            {
                //DcdEvent.Scanned -= DcdScannedDelegate;
                if (DcdHandle.GetCodeId(e.RequestID) == CodeId.NoData)
                {
                    throw new Exception("Данные не считаны");
                }
                string scanned = DcdHandle.ReadString(e.RequestID);
                scanned = scanned.Substring(0, scanned.Length - 1);

                //this.Invoke(Delegate, new object[] { scanned });
                InterpretScannedID(scanned);
                //DcdEvent.Scanned += DcdScannedDelegate;
            }
            catch (Exception ex)
            {
                MessageBox.Show("Ошибка: " + ex.Message, "Сканирование штрих-кода",
                                MessageBoxButtons.OK, MessageBoxIcon.Exclamation,
                                MessageBoxDefaultButton.Button1);
                return;
            }
        }