/// <summary>
        /// Handle data from the reader. Used in the scan mode.
        /// </summary>
        private void HandleData(Symbol.Barcode.ReaderData TheReaderData)
        {
            Phase phase = new Phase(TheReaderData.Text, currentPhase);

            phase.ShowDialog();
            this.Close();
        }
예제 #2
0
        public override ReaderResults GetNextResult()
        {
            //Log.Write(new LogEntry("SymbolReader: GetNextResult"));
            ReaderResults res = new ReaderResults();

            Symbol.Barcode.ReaderData readerData = _reader.Reader.GetNextReaderData();
            res.Data = readerData.Text;

            switch (readerData.Result)
            {
            case Symbol.Results.SUCCESS:
                res.Status = ScannerStatus.Success;
                break;

            case Symbol.Results.E_SCN_READTIMEOUT:
                res.Status = ScannerStatus.ReadTimeout;
                break;

            case Symbol.Results.CANCELED:
                res.Status = ScannerStatus.Canceled;
                break;

            case Symbol.Results.E_SCN_DEVICEFAILURE:
                res.Status = ScannerStatus.DeviceFailure;
                break;

            case Symbol.Results.E_SCN_READINCOMPATIBLE:
                res.Status = ScannerStatus.ReaderIncompatible;
                break;
            }

            return(res);
        }
예제 #3
0
        void _reader_OnRead(object sender, Symbol.Barcode.ReaderData readerData)
        {
            //Log.Write(new LogEntry("SymbolReader: _reader_OnRead"));
            ReaderResults res = new ReaderResults();

            res.Data = readerData.Text;

            switch (readerData.Result)
            {
            case Symbol.Results.SUCCESS:
                res.Status = ScannerStatus.Success;
                break;

            case Symbol.Results.E_SCN_READTIMEOUT:
                res.Status = ScannerStatus.ReadTimeout;
                break;

            case Symbol.Results.CANCELED:
                res.Status = ScannerStatus.Canceled;
                break;

            case Symbol.Results.E_SCN_DEVICEFAILURE:
                res.Status = ScannerStatus.DeviceFailure;
                break;

            case Symbol.Results.E_SCN_READINCOMPATIBLE:
                res.Status = ScannerStatus.ReaderIncompatible;
                break;
            }

            NotifyRead(res);
        }
예제 #4
0
        void InitReader2()
        {
            Symbol.Generic.Device MyDevice =
                Symbol.StandardForms.SelectDevice.Select(
                    Symbol.Barcode.Device.Title,
                    Symbol.Barcode.Device.AvailableDevices);

            mReader = new Symbol.Barcode.Reader(MyDevice);

            // Create the reader data.
            mReaderData = new Symbol.Barcode.ReaderData(
                Symbol.Barcode.ReaderDataTypes.Text,
                Symbol.Barcode.ReaderDataLengths.MaximumLabel);

            // Enable the Reader.
            mReader.Actions.Enable();

            switch (mReader.ReaderParameters.ReaderType)
            {
            case Symbol.Barcode.READER_TYPE.READER_TYPE_IMAGER:
                mReader.ReaderParameters.ReaderSpecific.ImagerSpecific.AimType = Symbol.Barcode.AIM_TYPE.AIM_TYPE_TRIGGER;
                break;

            case Symbol.Barcode.READER_TYPE.READER_TYPE_LASER:
                mReader.ReaderParameters.ReaderSpecific.LaserSpecific.AimType = Symbol.Barcode.AIM_TYPE.AIM_TYPE_TRIGGER;
                break;

            case Symbol.Barcode.READER_TYPE.READER_TYPE_CONTACT:
                throw new Exception("not support READER_TYPE_CONTACT");
            }
            mReader.Actions.SetParameters();

            mReader.ReadNotify += new EventHandler(mReader_ReadNotify);
        }
예제 #5
0
        /// <summary>
        /// Stop reading and disable/close reader
        /// </summary>
        private void TermReader()
        {
            // If we have a reader
            if (this.MyReader != null)
            {
                // Disable the reader
                this.MyReader.Actions.Disable();

                // Free it up
                this.MyReader.Dispose();

                // Indicate we no longer have one
                this.MyReader = null;
            }

            // If we have a reader data
            if (this.MyReaderData != null)
            {
                // Free it up
                this.MyReaderData.Dispose();

                // Indicate we no longer have one
                this.MyReaderData = null;
            }
        }
 private void HandleData(Symbol.Barcode.ReaderData TheReaderData)
 {
     //write handling logic//
     if (!isProductionOrderScanned)
     {
         if ("4792132408859" == TheReaderData.Text)
         {
             frmMessageBox form = new frmMessageBox(MessageTypes.Error, "Invalid production order, Please try again", "Scan Error");
             form.ShowDialog();
             this.barcodeScanner.StartRead(false);
         }
         else
         {
             lblProductionOrderScanned.Text = TheReaderData.Text;
             isProductionOrderScanned       = true;
             this.LoadWebs();
             this.barcodeScanner.StartRead(false);
         }
     }
     else
     {
         if ("4792132408859" == TheReaderData.Text)
         {
             frmMessageBox form = new frmMessageBox(MessageTypes.Error, "Invalid user, Please try again", "No user");
             form.ShowDialog();
             this.barcodeScanner.StartRead(false);
         }
         else
         {
             lblDeliveredToScanned.Text = TheReaderData.Text;
             this.UnloadScanner();
         }
     }
 }
예제 #7
0
        private bool InitReader()
        {
            // If reader is already present then fail initialize
            if (this.MyReader != null)
            {
                return(false);
            }

            // Create new reader, first available reader will be used.
            this.MyReader = new Symbol.Barcode.Reader();

            // Create reader data
            this.MyReaderData = new Symbol.Barcode.ReaderData(
                Symbol.Barcode.ReaderDataTypes.Text,
                Symbol.Barcode.ReaderDataLengths.MaximumLabel);

            // Create event handler delegate
            this.MyEventHandler = new EventHandler(MyReader_ReadNotify);

            // Enable reader, with wait cursor
            this.MyReader.Actions.Enable();

            //this.MyReader.Parameters.Feedback.Success.BeepTime = 2;

            // Attach to activate and deactivate events
            this.Activated  += new EventHandler(ReaderForm_Activated);
            this.Deactivate += new EventHandler(ReaderForm_Deactivate);

            return(true);
        }
예제 #8
0
        /// <summary>
        /// Initialize the reader.
        /// </summary>
        private bool InitReader()
        {
            //  If reader is already present, fail.
            if (MyReader != null)
            {
                return(false);
            }

            MyReader = new Symbol.Barcode.Reader();

            //  Create reader data.
            MyReaderData = new Symbol.Barcode.ReaderData(
                Symbol.Barcode.ReaderDataTypes.Text,
                Symbol.Barcode.ReaderDataLengths.DefaultText);

            //  Create event handler delegate.
            MyEventHandler = new EventHandler(MyReader_ReadNotify);

            //  Enable reader.
            MyReader.Actions.Enable();
            MyReader.Parameters.Feedback.Success.BeepTime      = 100;
            MyReader.Parameters.Feedback.Success.BeepFrequency = 3000;
            MyReader.Parameters.Feedback.Fail.BeepTime         = 0;
            MyReader.Parameters.Feedback.Fail.WaveFile         = "\\windows\\alarm3.wav";

            return(true);
        }
예제 #9
0
        void reader_ListChanged(object sender, ListChangedEventArgs e)
        {
            Symbol.Barcode.ReaderData nextReaderData = barcode_reader.ReaderData;
            if (nextReaderData.Result == Symbol.Results.SUCCESS)
            {
                tareTextBox.Text = nextReaderData.Text;
                var a = tareTextBox.Text;//

                /*var tare=tareTextBox.Text.Trim();//
                 * var indexTo = IndexToTextBox.Text.Trim();//
                 * var a = GeneratePack(tare, indexTo);//*/
                Pack p = new Pack();
                Pack.package = a;

                /*this.Hide();
                 * p.Closing += Frm2_Closing;*/
                if (barcode_reader != null)
                {
                    barcode_reader.Stop();
                    barcode_reader.Dispose();
                }

                this.Close();
                p.Show();
            }
            else
            {
                tareTextBox.Text = "Формат считанного Штрихового Кода - не распознан!";
                //Проигрываем звук - ненайденного ШК
                System.Media.SystemSounds.Exclamation.Play();
                System.Media.SystemSounds.Asterisk.Play();
                System.Media.SystemSounds.Exclamation.Play();
                System.Media.SystemSounds.Asterisk.Play();
            }
        }
예제 #10
0
파일: Main.cs 프로젝트: jpheary/Argix08
 private void HandleData(Symbol.Barcode.ReaderData readerData)
 {
     try {
         this.txtScan.Text = readerData.Text;
     }
     catch (Exception ex) { App.ReportError(ex); }
 }
예제 #11
0
 /// <summary>
 /// Handle data from the reader. Used in the scan mode.
 /// </summary>
 private void HandleData(Symbol.Barcode.ReaderData TheReaderData)
 {
     //write handling logic//
     if (this.IsDuplicate(TheReaderData.Text))
     {
         frmMessageBox form = new frmMessageBox(MessageTypes.Error, "This web is already scanned", "Duplicate");
         form.ShowDialog();
         this.barcodeScanner.StartRead(false);
     }
     else
     {
         if ("4792132408859" == TheReaderData.Text)
         {
             //error barcode
             frmMessageBox form = new frmMessageBox(MessageTypes.Error, "This is not a valid web", "Invalid Web");
             form.ShowDialog();
             this.barcodeScanner.StartRead(false);
         }
         else
         {
             var          Text = TheReaderData.Text;
             ListViewItem lv   = new ListViewItem(Text);
             this.barcodeScanner.StartRead(false);
             lv.SubItems.Add("Material");
             lv.SubItems.Add("Weight");
             lvInHouseAcknowledgement.Items.Add(lv);
         }
     }
 }
예제 #12
0
        private void HandleData(Symbol.Barcode.ReaderData TheReaderData)
        {
            txtNFe.Text = TheReaderData.Text;

            this.Refresh();

            BuscaNFe(TheReaderData.Text);
        }
예제 #13
0
        /// <summary>
        /// Read notification handler.
        /// </summary>
        private void myReader_ReadNotify(object Sender, EventArgs e)
        {
            // Checks if the Invoke method is required because the ReadNotify delegate is called by a different thread
            if (this.InvokeRequired)
            {
                // Executes the ReadNotify delegate on the main thread
                this.Invoke(myReadNotifyHandler, new object[] { Sender, e });
            }
            else
            {
                // Get ReaderData
                Symbol.Barcode.ReaderData TheReaderData = this.myScanSampleAPI.Reader.GetNextReaderData();

                switch (TheReaderData.Result)
                {
                case Symbol.Results.SUCCESS:

                    // Handle the data from this read & submit the next read.
                    HandleData(TheReaderData);
                    this.myScanSampleAPI.StartRead(false);

                    break;

                case Symbol.Results.E_SCN_READTIMEOUT:
                    this.myScanSampleAPI.StartRead(false);
                    break;

                case Symbol.Results.CANCELED:

                    break;

                case Symbol.Results.E_SCN_DEVICEFAILURE:

                    this.myScanSampleAPI.StopRead();
                    this.myScanSampleAPI.StartRead(false);
                    break;

                default:

                    string sMsg = "Read Failed\n"
                                  + "Result = "
                                  + (TheReaderData.Result).ToString();

                    if (TheReaderData.Result == Symbol.Results.E_SCN_READINCOMPATIBLE)
                    {
                        // If the failure is E_SCN_READINCOMPATIBLE, exit the application.

                        MessageBox.Show(Resources.GetString("AppExitMsg"), Resources.GetString("Failure"));

                        CloseScanForm();
                        return;
                    }

                    break;
                }
            }
        }
예제 #14
0
 private void HandleData(Symbol.Barcode.ReaderData TheReaderData)
 {
     try
     {
         EncontraProduto(TheReaderData.Text.PadLeft(14, '0'));
     }
     catch (Exception err)
     {
         MessageBox.Show(EDL.Properties.Resources.SYS999 + err.Message, Program.TituloMensagem, MessageBoxButtons.OK, MessageBoxIcon.Asterisk, MessageBoxDefaultButton.Button1);
     }
 }
예제 #15
0
        private void HandleData(Symbol.Barcode.ReaderData TheReaderData)
        {
            Cracha = TheReaderData.Text;

            txtSenha.Enabled  = true;
            txtSenha.Visible  = true;
            lblSenha.Visible  = true;
            btnEntrar.Visible = true;
            btnEntrar.Enabled = true;
            txtSenha.Text     = "";
            txtSenha.Focus();
        }
예제 #16
0
 void mReader_ReadNotify(object sender, EventArgs e)
 {
     Symbol.Barcode.ReaderData TheReaderData = mReader.GetNextReaderData();
     if (mReaderData.Result == Symbol.Results.SUCCESS)
     {
         var code = TheReaderData.Text;
         this.OnScannerReader(this, new ScanEventArgs()
         {
             BarCode = code
         });
     }
     StartRead(false);
 }
예제 #17
0
 /// <summary>
 /// Stop all reads on the reader
 /// </summary>
 private void StopRead()
 {
     // If we have a reader
     if (this.MyReader != null)
     {
         // Flush (Cancel all pending reads)
         this.MyReader.ReadNotify -= this.MyEventHandler;
         this.MyReader.Actions.Flush();
         this.MyReader.Dispose();
         this.MyReaderData.Dispose();
         this.MyReader     = null;
         this.MyReaderData = null;
     }
 }
예제 #18
0
        private void myReader_ReadNotify(object Sender, EventArgs e)
        {
            // Get ReaderData
            Symbol.Barcode.ReaderData TheReaderData = scanAPI.Reader.GetNextReaderData();

            switch (TheReaderData.Result)
            {
            case Symbol.Results.SUCCESS:

                // Handle the data from this read & submit the next read.

                this.scannedData.Text = TheReaderData.Text;
                scanAPI.StartRead(false);
                this.stateBox.Focus();
                break;

            case Symbol.Results.E_SCN_READTIMEOUT:


                scanAPI.StartRead(false);
                break;

            case Symbol.Results.CANCELED:

                break;

            case Symbol.Results.E_SCN_DEVICEFAILURE:

                scanAPI.StopRead();
                scanAPI.StartRead(false);
                break;

            default:

                string sMsg = "Read Failed\n"
                              + "Result = "
                              + (TheReaderData.Result).ToString();

                if (TheReaderData.Result == Symbol.Results.E_SCN_READINCOMPATIBLE)
                {
                    // If the failure is E_SCN_READINCOMPATIBLE, exit the application.
                    MessageBox.Show("AppExitMsg", "Failure");

                    this.Close();
                    return;
                }

                break;
            }
        }
예제 #19
0
        private void HandleData(Symbol.Barcode.ReaderData TheReaderData)
        {
            if (TheReaderData.Text.Length <= 6)
            {
                txtFornecedorBipado.Text = TheReaderData.Text;
                this.Refresh();

                BuscaFornecedor(TheReaderData.Text);
            }
            else
            {
                MessageBox.Show(EDL.Properties.Resources.SYS022, Program.TituloMensagem, MessageBoxButtons.OK, MessageBoxIcon.Exclamation, MessageBoxDefaultButton.Button1);
            }
        }
예제 #20
0
        /// <summary>
        /// Read complete or failure notification
        /// </summary>
        private void MyReader_ReadNotify(object sender, EventArgs e)
        {
            Symbol.Barcode.ReaderData TheReaderData = this.MyReader.GetNextReaderData();

            // If it is a successful read (as opposed to a failed one)
            if (TheReaderData.Result == Symbol.Results.SUCCESS)
            {
                //  Handle the data from this read.
                RFScanEventArgs eRFScan = new RFScanEventArgs(TheReaderData.Text);
                OnRFScan(eRFScan);

                // Start the next read
                this.StartRead();
            }
        }
예제 #21
0
        /// <summary>
        /// Stop reading and disable/close the reader.
        /// </summary>
        public void TermReader()
        {
            // If we have a reader
            if (mReader != null)
            {
                try
                {
                    // stop all the notifications.
                    StopRead();

                    //Detach all the notification handler if the user has not done it already.
                    DetachReadNotify();
                    DetachStatusNotify();

                    // Disable the reader.
                    mReader.Actions.Disable();

                    // Free it up.
                    mReader.Dispose();

                    // Make the reference null.
                    mReader = null;
                }

                catch (Exception ex)
                {
                    MessageBox.Show(ex.Message);
                }
            }

            // After disposing the reader, dispose the reader data.
            if (mReaderData != null)
            {
                try
                {
                    // Free it up.
                    mReaderData.Dispose();

                    // Make the reference null.
                    mReaderData = null;
                }

                catch (Exception ex)
                {
                    MessageBox.Show(ex.Message);
                }
            }
        }
예제 #22
0
 void reader_ListChanged(object sender, ListChangedEventArgs e)
 {
     Symbol.Barcode.ReaderData nextReaderData = barcode_reader.ReaderData;
     if (nextReaderData.Result == Symbol.Results.SUCCESS)
     {
         textBox1.Text = nextReaderData.Text;
     }
     else
     {
         textBox1.Text = "Формат считанного Штрихового Кода - не распознан!";
         //Проигрываем звук - ненайденного ШК
         System.Media.SystemSounds.Exclamation.Play();
         System.Media.SystemSounds.Asterisk.Play();
         System.Media.SystemSounds.Exclamation.Play();
         System.Media.SystemSounds.Asterisk.Play();
     }
 }
예제 #23
0
        private void personnelBarcode_OnRead(object sender, Symbol.Barcode.ReaderData readerData)
        {
            if (readerData.Type == Symbol.Barcode.DecoderTypes.PDF417)
            {
                //debug purposes only
                rawDataLabel.Text = readerData.Text;

                util.CAC_PDF417 CAC_PDF417 = new util.CAC_PDF417(readerData.Text);

                lastNameAddTextBox.Text         = CAC_PDF417.LastName;
                firstNameAddTextBox.Text        = CAC_PDF417.FirstName;
                middleInitialAddTextBox.Text    = CAC_PDF417.MiddleInitial;
                ediAddTextBox.Text              = CAC_PDF417.EDI;
                rankAddTextBox.Text             = CAC_PDF417.Rank;
                branchAddComboBox.SelectedValue = CAC_PDF417.BranchCode;
            }
        }
예제 #24
0
 //сканувати штрихкод
 private string ScanBarcodes()
 {
     Symbol.Barcode.ReaderData nextReaderData = barcode_reader2.ReaderData;
     if (nextReaderData.Result == Symbol.Results.SUCCESS)
     {
         return(nextReaderData.Text);
     }
     else
     {
         textBox1.Text = "Формат зчитанного Штрихового Кода - не розпізнано!";//Формат считанного Штрихового Кода - не распознан
         //Проигрываем звук - ненайденного ШК
         System.Media.SystemSounds.Exclamation.Play();
         System.Media.SystemSounds.Asterisk.Play();
         System.Media.SystemSounds.Exclamation.Play();
         System.Media.SystemSounds.Asterisk.Play();
         return(null);
     }
 }
예제 #25
0
 /// <summary>
 /// Read notification handler.
 /// </summary>
 private void myReader_ReadNotify(object Sender, EventArgs e)
 {
     // Checks if the Invoke method is required because the ReadNotify delegate is called by a different thread
     if (this.InvokeRequired)
     {
         // Executes the ReadNotify delegate on the main thread
         this.Invoke(myReadNotifyHandler, new object[] { Sender, e });
     }
     else
     {
         // Get ReaderData
         Symbol.Barcode.ReaderData TheReaderData = this.barcodeScanner.Reader.GetNextReaderData();
         if (TheReaderData.Result == Symbol.Results.SUCCESS)
         {
             HandleData(TheReaderData);
         }
     }
 }
        /// <summary>
        /// Read notification handler.
        /// </summary>
        private void currentBarcodeReadNotifyHandler(object Sender, EventArgs e)
        {
            // Checks if the Invoke method is required because the ReadNotify delegate is called by a different thread
            if (this.InvokeRequired)
            {
                // Executes the ReadNotify delegate on the main thread
                this.Invoke(barcodeReadNotifyHandler, new object[] { Sender, e });
            }
            else
            {
                // Get ReaderData
                Symbol.Barcode.ReaderData TheReaderData = barcodeAPI.Reader.GetNextReaderData();

                switch (TheReaderData.Result)
                {
                case Symbol.Results.SUCCESS:
                    // Handle the data from this read & submit the next read.
                    HandleData(TheReaderData);
                    barcodeAPI.StartRead(false);
                    break;

                case Symbol.Results.E_SCN_READTIMEOUT:
                    errorOnBarcodeRead("");
                    break;

                case Symbol.Results.CANCELED:
                    errorOnBarcodeRead("");
                    break;

                case Symbol.Results.E_SCN_DEVICEFAILURE:
                    errorOnBarcodeRead("");
                    break;

                default:
                    errorOnBarcodeRead("Read Failed\nResult = " + (TheReaderData.Result).ToString());
                    //if (TheReaderData.Result == Symbol.Results.E_SCN_READINCOMPATIBLE)
                    //{
                    //    // If the failure is E_SCN_READINCOMPATIBLE, exit the application.
                    //    errorOnBarcodeRead("");
                    //}
                    break;
                }
            }
        }
예제 #27
0
        private void myReader_OnRead(object sender, EventArgs e)
        {
            Symbol.Barcode.ReaderData TheReaderData = Scanning.MyReaderData;

            // If it is a successful read (as opposed to a failed one)
            if (TheReaderData.Result == Symbol.Results.SUCCESS)
            {
                if (TheReaderData.Type == Symbol.Barcode.DecoderTypes.PDF417)
                {
                    util.CAC_PDF417 CAC_PDF417 = new util.CAC_PDF417(TheReaderData.Text);

                    lastNameTextBox.Text         = CAC_PDF417.LastName;
                    firstNameTextBox.Text        = CAC_PDF417.FirstName;
                    middleInitialTextBox.Text    = CAC_PDF417.MiddleInitial;
                    ediTextBox.Text              = CAC_PDF417.EDI;
                    rankTextBox.Text             = CAC_PDF417.Rank;
                    branchComboBox.SelectedValue = CAC_PDF417.BranchCode;

                    if (TheReaderData.MultiPart)
                    {
                        MessageBox.Show(TheReaderData.AuxData.Text);
                    }
                }

                // Start the next read
                Scanning.StartRead();
            }
            else
            {
                string sMsg = "Read Failed\n"
                              + "Result = "
                              + (TheReaderData.Result).ToString();

                MessageBox.Show(sMsg, "ReadNotify");

                if (TheReaderData.Result == Symbol.Results.E_SCN_READINCOMPATIBLE)
                {
                    // If the failure is E_SCN_READINCOMPATIBLE, exit the application.
                    MessageBox.Show("The application will now exit.");
                    this.Close();
                    return;
                }
            }
        }
예제 #28
0
        /// <summary>
        /// Handle data from the reader. Used in the scan mode.
        /// </summary>
        private void HandleData(Symbol.Barcode.ReaderData TheReaderData)
        {
            StockItem item = service.GetStockItem(TheReaderData.Text);

            if (item != null)
            {
                lblNo.Text              = item.No_;
                lblDescription.Text     = item.Description;
                lblCurrentStockUOM.Text = item.UOM;
                lblAmountUOM.Text       = item.UOM;
                lblNewStockUOM.Text     = item.UOM;
                lblCurrentStock.Text    = (item.StockQuantity != null ? ((decimal)item.StockQuantity).ToString("0.####################"):"0");
            }
            else
            {
                lblNo.Text          = TheReaderData.Text;
                lblDescription.Text = "Product code kon niet gevonden worden.";
            }
        }
예제 #29
0
        private void myReader_OnRead(object sender, EventArgs e)
        {
            Symbol.Barcode.ReaderData TheReaderData = Scanning.MyReaderData;

            // If it is a successful read (as opposed to a failed one)
            if (TheReaderData.Result == Symbol.Results.SUCCESS)
            {
                if (TheReaderData.Type == Symbol.Barcode.DecoderTypes.DATAMATRIX)
                {
                    //Symbol.Barcode.DecoderTypes.DATAMATRIX
                    util.Equip_DataMatrix scannedDataMatrix = new util.Equip_DataMatrix(TheReaderData.Text);

                    serialNumberTextBox.Text  = scannedDataMatrix.SerialNumber;
                    mfrComboBox.SelectedValue = scannedDataMatrix.MFR;
                    populateProductComboBox(mfrComboBox.SelectedValue.ToString());
                    productComboBox.SelectedValue = scannedDataMatrix.PartNumber;

                    if (TheReaderData.MultiPart)
                    {
                        MessageBox.Show(TheReaderData.AuxData.Text);
                    }
                }

                // Start the next read
                Scanning.StartRead();
            }
            else
            {
                string sMsg = "Read Failed\n"
                              + "Result = "
                              + (TheReaderData.Result).ToString();

                MessageBox.Show(sMsg, "ReadNotify");

                if (TheReaderData.Result == Symbol.Results.E_SCN_READINCOMPATIBLE)
                {
                    // If the failure is E_SCN_READINCOMPATIBLE, exit the application.
                    MessageBox.Show("The application will now exit.");
                    this.Close();
                    return;
                }
            }
        }
예제 #30
0
 /// <summary>
 /// Handle data from the reader. Used in the scan mode.
 /// </summary>
 private void HandleData(Symbol.Barcode.ReaderData TheReaderData)
 {
     //write handling logic//
     if ("4792132408859" == TheReaderData.Text)
     {
         //MessageBox.Show("Invalid User", "Error", MessageBoxButtons.OK, MessageBoxIcon.Asterisk, MessageBoxDefaultButton.Button1);
         frmMessageBox form = new frmMessageBox(MessageTypes.Error, "Invalid barcode, Please try again", "Login error");
         form.ShowDialog();
         this.barcodeScanner.StartRead(false);
     }
     else
     {
         UnloadScanner();
         frmMenu menu = new frmMenu();
         menu.RefToUserLogin = this;
         menu.userBarcode    = TheReaderData.Text;
         menu.Show();
         this.Hide();
     }
 }
예제 #31
0
        /// <summary>
        /// Stop reading and disable/close the reader.
        /// </summary>
        public void TermReader()
        {
            // If we have a reader
            if (myReader != null)
            {
                try
                {
                    // stop all the notifications.
                    StopRead();

                    //Detach all the notification handler if the user has not done it already.
                    DetachReadNotify();
                    DetachStatusNotify();

                    // Disable the reader.
                    myReader.Actions.Disable();

                    // Free it up.
                    myReader.Dispose();

                    // Make the reference null.
                    myReader = null;

                    myAudioController.Dispose();
                    myAudioController = null;
                }

                catch (Symbol.Exceptions.OperationFailureException ex)
                {
                    MessageBox.Show(Resources.GetString("TermReader") + "\n" +
                        Resources.GetString("OperationFailure") + "\n" + ex.Message +
                        "\n" +
                        Resources.GetString("Result") + " = " + (Symbol.Results)((uint)ex.Result)
                        );
                }
                catch (Symbol.Exceptions.InvalidRequestException ex)
                {
                    MessageBox.Show(Resources.GetString("TermReader") + "\n" +
                        Resources.GetString("InvalidRequest") + "\n" +
                        ex.Message);
                }
                catch (Symbol.Exceptions.InvalidIndexerException ex)
                {
                    MessageBox.Show(Resources.GetString("TermReader") + "\n" +
                        Resources.GetString("InvalidIndexer") + "\n" +
                        ex.Message);
                };
            }

            // After disposing the reader, dispose the reader data.
            if (myReaderData != null)
            {
                try
                {
                    // Free it up.
                    myReaderData.Dispose();

                    // Make the reference null.
                    myReaderData = null;
                }

                catch (Symbol.Exceptions.OperationFailureException ex)
                {
                    MessageBox.Show(Resources.GetString("TermReader") + "\n" +
                        Resources.GetString("OperationFailure") + "\n" + ex.Message +
                        "\n" +
                        Resources.GetString("Result") + " = " + (Symbol.Results)((uint)ex.Result)
                        );
                }
                catch (Symbol.Exceptions.InvalidRequestException ex)
                {
                    MessageBox.Show(Resources.GetString("TermReader") + "\n" +
                        Resources.GetString("InvalidRequest") + "\n" +
                        ex.Message);
                }
                catch (Symbol.Exceptions.InvalidIndexerException ex)
                {
                    MessageBox.Show(Resources.GetString("TermReader") + "\n" +
                        Resources.GetString("InvalidIndexer") + "\n" +
                        ex.Message);
                };
            }
        }
예제 #32
0
        /// <summary>
        /// Initialize the reader.
        /// </summary>
        public bool InitReader()
        {
            // If the reader is already initialized then fail the initialization.
            if (myReader != null)
            {
                return false;
            }
            else // Else initialize the reader.
            {
                try
                {
                    // Get the device selected by the user.
                    Symbol.Generic.Device MyDevice =
                        Symbol.StandardForms.SelectDevice.Select(
                        Symbol.Barcode.Device.Title,
                        Symbol.Barcode.Device.AvailableDevices);

                    //Select Device from device list
                    Symbol.Audio.Device audioDevice = (Symbol.Audio.Device)Symbol.StandardForms.SelectDevice.Select(
                        Symbol.Audio.Controller.Title,
                        Symbol.Audio.Device.AvailableDevices);

                    if (MyDevice == null)
                    {
                        MessageBox.Show(Resources.GetString("NoDeviceSelected"), Resources.GetString("SelectDevice"));
                        return false;
                    }

                    // Create the reader, based on selected device.
                    myReader = new Symbol.Barcode.Reader(MyDevice);

                    // Create the reader data.
                    myReaderData = new Symbol.Barcode.ReaderData(
                        Symbol.Barcode.ReaderDataTypes.Text,
                        Symbol.Barcode.ReaderDataLengths.MaximumLabel);

                    // Enable the Reader.
                    myReader.Actions.Enable();

                    // In this sample, we are setting the aim type to trigger.
                    switch (myReader.ReaderParameters.ReaderType)
                    {
                        case Symbol.Barcode.READER_TYPE.READER_TYPE_IMAGER:
                            myReader.ReaderParameters.ReaderSpecific.ImagerSpecific.AimType = Symbol.Barcode.AIM_TYPE.AIM_TYPE_TRIGGER;
                            break;
                        case Symbol.Barcode.READER_TYPE.READER_TYPE_LASER:
                            myReader.ReaderParameters.ReaderSpecific.LaserSpecific.AimType = Symbol.Barcode.AIM_TYPE.AIM_TYPE_TRIGGER;
                            break;
                        case Symbol.Barcode.READER_TYPE.READER_TYPE_CONTACT:
                            // AimType is not supported by the contact readers.
                            break;
                    }
                    myReader.Actions.SetParameters();

                    //check the device type
                    switch (audioDevice.AudioType)
                    {
                        //if standard device
                        case Symbol.Audio.AudioType.StandardAudio:
                            myAudioController = new Symbol.Audio.StandardAudio(audioDevice);
                            break;

                        //if simulated device
                        case Symbol.Audio.AudioType.SimulatedAudio:
                            myAudioController = new Symbol.Audio.SimulatedAudio(audioDevice);
                            break;

                        default:
                            throw new Symbol.Exceptions.InvalidDataTypeException("Unknown Device Type");

                    }
                    myAudioController.BeeperVolume = 0;

                }

                catch (Symbol.Exceptions.OperationFailureException ex)
                {
                    MessageBox.Show(Resources.GetString("InitReader") + "\n" +
                        Resources.GetString("OperationFailure") + "\n" + ex.Message +
                        "\n" +
                        Resources.GetString("Result") + " = " + (Symbol.Results)((uint)ex.Result)
                        );

                    return false;
                }
                catch (Symbol.Exceptions.InvalidRequestException ex)
                {
                    MessageBox.Show(Resources.GetString("InitReader") + "\n" +
                        Resources.GetString("InvalidRequest") + "\n" +
                        ex.Message);

                    return false;
                }
                catch (Symbol.Exceptions.InvalidIndexerException ex)
                {
                    MessageBox.Show(Resources.GetString("InitReader") + "\n" +
                        Resources.GetString("InvalidIndexer") + "\n" +
                        ex.Message);

                    return false;
                };

                return true;
            }
        }