Example #1
0
        //Ct50 code
        public void OnCreated(AidcManager aidcManager)
        {
            bool issuccessful = false;

            manager = aidcManager;
            // use the manager to create a BarcodeReader with a session
            // associated with the internal imager.
            try
            {
                reader       = manager.CreateBarcodeReader();
                issuccessful = true;
            }
            catch (Exception exc)
            {
                issuccessful = false;
            }

            if (issuccessful)
            {
                try
                {
                    // apply settings
                    reader.SetProperty(BarcodeReader.PropertyCode39Enabled, true);
                    reader.SetProperty(BarcodeReader.PropertyDatamatrixEnabled, true);

                    reader.SetProperty(BarcodeReader.PropertyCode128Enabled, true);
                    reader.SetProperty(BarcodeReader.PropertyGs1128Enabled, true);
                    reader.SetProperty(BarcodeReader.PropertyQrCodeEnabled, true);
                    reader.SetProperty(BarcodeReader.PropertyUpcAEnable, true);
                    reader.SetProperty(BarcodeReader.PropertyEan13Enabled, true);
                    reader.SetProperty(BarcodeReader.PropertyAztecEnabled, true);
                    reader.SetProperty(BarcodeReader.PropertyCodabarEnabled, true);
                    reader.SetProperty(BarcodeReader.PropertyInterleaved25Enabled, true);
                    reader.SetProperty(BarcodeReader.PropertyPdf417Enabled, true);
                    // Set Max Code 39 barcode length
                    reader.SetProperty(BarcodeReader.PropertyCode39MaximumLength, 10);

                    // Disable bad read response, handle in onFailureEvent
                    reader.SetProperty(BarcodeReader.PropertyNotificationBadReadEnabled, true);

                    // set the trigger mode to client control
                    reader.SetProperty(BarcodeReader.PropertyTriggerControlMode, BarcodeReader.TriggerControlModeClientControl);
                }
                catch (UnsupportedPropertyException)
                {
                    Toast.MakeText(this, "Failed to apply properties", ToastLength.Short).Show();
                }

                // register bar code event listener
                reader.AddBarcodeListener(this as BarcodeReader.IBarcodeListener);

                // register trigger state change listener
                reader.AddTriggerListener(this as BarcodeReader.ITriggerListener);

                reader.Claim();
            }
        }
 protected override void OnResume()
 {
     base.OnResume();
     if (_barcodeReader != null)
     {
         try
         {
             _barcodeReader.Claim();
         }
         catch (ScannerUnavailableException e)
         {
             Toast.MakeText(this, "Scanner unavailable", ToastLength.Short).Show();
         }
     }
 }
Example #3
0
        protected override void OnResume()
        {
            base.OnResume();
            if (reader != null)
            {
                try
                {
                    reader.Claim();
                }
                catch (ScannerUnavailableException e)
                {
                    Console.WriteLine(e.ToString());
                    Console.Write(e.StackTrace);

                    Toast.MakeText(this, "Scanner unavailable", ToastLength.Short).Show();
                }
            }
        }