Exemplo n.º 1
0
        void InitializeAndStartBarcodeScanning()
        {
            ScanSettings settings = ScanSettings.Create();

            int[] symbologiesToEnable = new int[] {
                Barcode.SymbologyEan13,
                Barcode.SymbologyEan8,
                Barcode.SymbologyUpca,
                Barcode.SymbologyDataMatrix,
                Barcode.SymbologyQr,
                Barcode.SymbologyCode39,
                Barcode.SymbologyCode128,
                Barcode.SymbologyInterleaved2Of5,
                Barcode.SymbologyUpce
            };

            foreach (int symbology in symbologiesToEnable)
            {
                settings.SetSymbologyEnabled(symbology, true);
            }

            SymbologySettings symSettings = settings.GetSymbologySettings(Barcode.SymbologyCode128);

            short[] activeSymbolCounts = new short[] {
                7, 8, 9, 10, 11, 12, 13, 14, 15, 16, 17, 18, 19, 20
            };
            symSettings.SetActiveSymbolCounts(activeSymbolCounts);
            barcodePicker = new BarcodePicker(this, settings);
            barcodePicker.SetOnScanListener(this);
            SetContentView(barcodePicker);
        }
Exemplo n.º 2
0
        protected override void OnCreate(Bundle bundle)
        {
            base.OnCreate(bundle);
            RequestWindowFeature(WindowFeatures.NoTitle);
            Window.SetFlags(WindowManagerFlags.Fullscreen, WindowManagerFlags.Fullscreen);

            // Set the app key before instantiating the picker.
            ScanditLicense.AppKey = appKey;

            // The scanning behavior of the barcode picker is configured through scan
            // settings. We start with empty scan settings and enable a very generous
            // set of symbologies. In your own apps, only enable the symbologies you
            // actually need.
            ScanSettings settings = ScanSettings.Create();

            int[] symbologiesToEnable = new int[] {
                Barcode.SymbologyEan13,
                Barcode.SymbologyEan8,
                Barcode.SymbologyUpca,
                Barcode.SymbologyDataMatrix,
                Barcode.SymbologyQr,
                Barcode.SymbologyCode39,
                Barcode.SymbologyCode128,
                Barcode.SymbologyInterleaved2Of5,
                Barcode.SymbologyUpce
            };

            for (int sym = 0; sym < symbologiesToEnable.Length; sym++)
            {
                settings.SetSymbologyEnabled(symbologiesToEnable[sym], true);
            }

            // Some 1d barcode symbologies allow you to encode variable-length data. By default, the
            // Scandit BarcodeScanner SDK only scans barcodes in a certain length range. If your
            // application requires scanning of one of these symbologies, and the length is falling
            // outside the default range, you may need to adjust the "active symbol counts" for this
            // symbology. This is shown in the following few lines of code.

            SymbologySettings symSettings = settings.GetSymbologySettings(Barcode.SymbologyCode128);

            short[] activeSymbolCounts = new short[] {
                7, 8, 9, 10, 11, 12, 13, 14, 15, 16, 17, 18, 19, 20
            };
            symSettings.SetActiveSymbolCounts(activeSymbolCounts);
            // For details on defaults and how to calculate the symbol counts for each symbology, take
            // a look at http://docs.scandit.com/stable/c_api/symbologies.html.

            picker = new BarcodePicker(this, settings);

            // Set listener for the scan event.
            picker.SetOnScanListener(this);

            // Show the scan user interface
            SetContentView(picker);
        }
Exemplo n.º 3
0
        void InitializeAndStartBarcodeScanning()
        {
            // The scanning behavior of the barcode picker is configured through scan
            // settings. We start with empty scan settings and enable a very generous
            // set of symbologies. In your own apps, only enable the symbologies you
            // actually need.
            ScanSettings settings = ScanSettings.Create();

            int[] symbologiesToEnable = new int[] {
                Barcode.SymbologyEan13,
                Barcode.SymbologyEan8,
                Barcode.SymbologyUpca,
                Barcode.SymbologyDataMatrix,
                Barcode.SymbologyQr,
                Barcode.SymbologyCode39,
                Barcode.SymbologyCode128,
                Barcode.SymbologyInterleaved2Of5,
                Barcode.SymbologyUpce
            };

            foreach (int symbology in symbologiesToEnable)
            {
                settings.SetSymbologyEnabled(symbology, true);
            }

            // Some 1d barcode symbologies allow you to encode variable-length data. By default, the
            // Scandit BarcodeScanner SDK only scans barcodes in a certain length range. If your
            // application requires scanning of one of these symbologies, and the length is falling
            // outside the default range, you may need to adjust the "active symbol counts" for this
            // symbology. This is shown in the following few lines of code.

            SymbologySettings symSettings = settings.GetSymbologySettings(Barcode.SymbologyCode128);

            short[] activeSymbolCounts = new short[] {
                7, 8, 9, 10, 11, 12, 13, 14, 15, 16, 17, 18, 19, 20
            };
            symSettings.SetActiveSymbolCounts(activeSymbolCounts);
            // For details on defaults and how to calculate the symbol counts for each symbology, take
            // a look at http://docs.scandit.com/stable/c_api/symbologies.html.

            barcodePicker = new BarcodePicker(this, settings);

            // Set listener for the scan event.
            barcodePicker.SetOnScanListener(this);

            // Show the scan user interface
            SetContentView(barcodePicker);
        }
Exemplo n.º 4
0
        protected override void OnCreate(Bundle bundle)
        {
            base.OnCreate(bundle);
            RequestWindowFeature(WindowFeatures.NoTitle);
            Window.SetFlags(WindowManagerFlags.Fullscreen, WindowManagerFlags.Fullscreen);
            ScanditLicense.AppKey = appKey;
            ScanSettings settings = ScanSettings.Create();

            int[] symbologiesToEnable = new int[] {
                Barcode.SymbologyEan13,
                Barcode.SymbologyEan8,
                Barcode.SymbologyUpca,
                Barcode.SymbologyDataMatrix,
                Barcode.SymbologyQr,
                Barcode.SymbologyCode39,
                Barcode.SymbologyCode128,
                Barcode.SymbologyInterleaved2Of5,
                Barcode.SymbologyUpce
            };

            for (int sym = 0; sym < symbologiesToEnable.Length; sym++)
            {
                settings.SetSymbologyEnabled(symbologiesToEnable[sym], true);
            }

            SymbologySettings symSettings = settings.GetSymbologySettings(Barcode.SymbologyCode128);

            short[] activeSymbolCounts = new short[] {
                7, 8, 9, 10, 11, 12, 13, 14, 15, 16, 17, 18, 19, 20
            };
            symSettings.SetActiveSymbolCounts(activeSymbolCounts);
            // For details on defaults and how to calculate the symbol counts for each symbology, take
            // a look at http://docs.scandit.com/stable/c_api/symbologies.html.

            picker = new BarcodePicker(this, settings);
            picker.SetOnScanListener(this);
            SetContentView(picker);
        }
        protected override void OnElementChanged(ElementChangedEventArgs <CustomStackLayout> e)
        {
            base.OnElementChanged(e);

            //var test = this as ViewGroup;

            if (e.NewElement != null)
            {
                // Set the app key before instantiating the picker.
                ScanditLicense.AppKey = appKey;

                // The scanning behavior of the barcode picker is configured through scan
                // settings. We start with empty scan settings and enable a very generous
                // set of symbologies. In your own apps, only enable the symbologies you
                // actually need.
                ScanSettings settings            = ScanSettings.Create();
                int[]        symbologiesToEnable = new int[]
                {
                    Barcode.SymbologyEan13,
                    Barcode.SymbologyEan8,
                    Barcode.SymbologyUpca,
                    Barcode.SymbologyDataMatrix,
                    Barcode.SymbologyQr,
                    Barcode.SymbologyCode39,
                    Barcode.SymbologyCode128,
                    Barcode.SymbologyInterleaved2Of5,
                    Barcode.SymbologyUpce
                };

                for (int sym = 0; sym < symbologiesToEnable.Length; sym++)
                {
                    settings.SetSymbologyEnabled(symbologiesToEnable[sym], true);
                }

                //// Some 1d barcode symbologies allow you to encode variable-length data. By default, the
                //// Scandit BarcodeScanner SDK only scans barcodes in a certain length range. If your
                //// application requires scanning of one of these symbologies, and the length is falling
                //// outside the default range, you may need to adjust the "active symbol counts" for this
                //// symbology. This is shown in the following few lines of code.

                SymbologySettings symSettings        = settings.GetSymbologySettings(Barcode.SymbologyCode128);
                short[]           activeSymbolCounts = new short[]
                {
                    7, 8, 9, 10, 11, 12, 13, 14, 15, 16, 17, 18, 19, 20
                };
                symSettings.SetActiveSymbolCounts(activeSymbolCounts);
                // For details on defaults and how to calculate the symbol counts for each symbology, take
                // a look at http://docs.scandit.com/stable/c_api/symbologies.html.

                picker = new BarcodePicker(this.Context, settings);

                picker.OverlayView.SetViewfinderDimension(0.5f, 0.9f, 0.5f, 0.9f);
                picker.OverlayView.SetTorchEnabled(false);


                // Set listener for the scan event.
                picker.SetOnScanListener(this);

                picker.StartScanning();

                //picker.Scan += (sender, args) =>
                //{

                //};

                AddView(picker);

                //SetNativeControl(picker);
            }
        }