Exemplo n.º 1
0
        /// <summary>
        /// Returns the zxing reader class for the current specified ScanMode.
        /// </summary>
        /// <returns></returns>
        internal static com.google.zxing.Reader GetReader(BarcodeFormat format)
        {
            Dictionary <object, object> zxingHints
                = new Dictionary <object, object>()
                {
                { DecodeHintType.TRY_HARDER, true }
                };

            com.google.zxing.Reader r;
            switch (format.Name)
            {
            case "CODE_128":
                r = new com.google.zxing.oned.Code128Reader();
                break;

            case "CODE_39":
                r = new com.google.zxing.oned.Code39Reader();
                break;

            case "EAN_13":
                r = new com.google.zxing.oned.EAN13Reader();
                break;

            case "EAN_8":
                r = new com.google.zxing.oned.EAN8Reader();
                break;

            case "ITF":
                r = new com.google.zxing.oned.ITFReader();
                break;

            case "UPC_A":
                r = new com.google.zxing.oned.UPCAReader();
                break;

            case "UPC_E":
                r = new com.google.zxing.oned.UPCEReader();
                break;

            case "QR_CODE":
                r = new com.google.zxing.qrcode.QRCodeReader();
                break;

            case "DATAMATRIX":
                r = new com.google.zxing.datamatrix.DataMatrixReader();
                break;

            case "ALL_1D":
                r = new com.google.zxing.oned.MultiFormatOneDReader(zxingHints);
                break;

            //Auto-Detect:
            case "UPC_EAN":
            default:
                r = new com.google.zxing.oned.MultiFormatUPCEANReader(zxingHints);
                break;
            }
            return(r);
        }
Exemplo n.º 2
0
        /// <summary>
        /// Returns the zxing reader class for the current specified ScanMode.
        /// </summary>
        /// <returns></returns>
        internal static com.google.zxing.Reader GetReader(BarcodeFormat format)
        {
            Dictionary<object, object> zxingHints
                = new Dictionary<object, object>() { { DecodeHintType.TRY_HARDER, true } };
            com.google.zxing.Reader r;
            switch (format.Name)
            {
                case "CODE_128":
                    r = new com.google.zxing.oned.Code128Reader();
                    break;
                case "CODE_39":
                    r = new com.google.zxing.oned.Code39Reader();
                    break;
                case "EAN_13":
                    r = new com.google.zxing.oned.EAN13Reader();
                    break;
                case "EAN_8":
                    r = new com.google.zxing.oned.EAN8Reader();
                    break;
                case "ITF":
                    r = new com.google.zxing.oned.ITFReader();
                    break;
                case "UPC_A":
                    r = new com.google.zxing.oned.UPCAReader();
                    break;
                case "UPC_E":
                    r = new com.google.zxing.oned.UPCEReader();
                    break;
                case "QR_CODE":
                    r = new com.google.zxing.qrcode.QRCodeReader();
                    break;
                case "DATAMATRIX":
                    r = new com.google.zxing.datamatrix.DataMatrixReader();
                    break;

                case "ALL_1D":
                    r = new com.google.zxing.oned.MultiFormatOneDReader(zxingHints);
                    break;
                
                //Auto-Detect:
                case "UPC_EAN":
                default:
                    r = new com.google.zxing.oned.MultiFormatUPCEANReader(zxingHints);
                    break; 
            }
            return r;
        }
Exemplo n.º 3
0
        /// <summary>
        /// Returns the zxing reader class for the current specified ScanMode.
        /// </summary>
        /// <returns></returns>
        public static com.google.zxing.Reader GetReader()
        {
            com.google.zxing.Reader r;
            switch (WP7BarcodeManager.ScanMode.Name)
            {
                case "CODE_128":
                    r  = new com.google.zxing.oned.Code128Reader();
                    break;
                case "CODE_39":
                    r  = new com.google.zxing.oned.Code39Reader();
                    break;
                case "EAN_13":
                    r  = new com.google.zxing.oned.EAN13Reader();
                    break;
                case "EAN_8":
                    r  = new com.google.zxing.oned.EAN8Reader();
                    break;
                case "ITF":
                    r  = new com.google.zxing.oned.ITFReader();
                    break;
                case "UPC_A":
                    r  = new com.google.zxing.oned.UPCAReader();
                    break;
                case "UPC_E":
                    r  = new com.google.zxing.oned.UPCEReader();
                    break;
                case "QR_CODE":
                    r  = new com.google.zxing.qrcode.QRCodeReader();
                    break;
                case "DATAMATRIX":
                    r  = new com.google.zxing.datamatrix.DataMatrixReader();
                    break;

                //Auto-Detect:
                case "UPC_EAN":
                    r = new com.google.zxing.oned.MultiFormatUPCEANReader(zxingHints);
                    break;
                case "ALL_1D":
                    r = new com.google.zxing.oned.MultiFormatOneDReader(zxingHints);
                    break;

                default:
                    r = null;
                    if (LastCaptureResults != null)
                    {
                        LastCaptureResults.ExceptionThrown = new ArgumentException("Error: Unknown barcode type");
                    }
                    throw new ArgumentException("Error: Unknown barcode type");
            }
            return r;
        }