public ByteMatrix encode(String contents, BarcodeFormat format, int width, int height,Hashtable hints){
     if (format == BarcodeFormat.QR_CODE) {
       return new QRCodeWriter().encode(contents, format, width, height, hints);
     } else {
       throw new ArgumentException("No encoder available for format " + format);
     }
 }   
Beispiel #2
0
 public Result(string text, sbyte[] rawBytes, ResultPoint[] resultPoints, BarcodeFormat format, long timestamp)
 {
     this.text = text;
     this.rawBytes = rawBytes;
     this.resultPoints = resultPoints;
     this.format = format;
     this.resultMetadata = null;
     this.timestamp = timestamp;
 }
Beispiel #3
0
 public Result(System.String text, sbyte[] rawBytes, ResultPoint[] resultPoints, BarcodeFormat format)
 {
     if (text == null && rawBytes == null)
     {
         throw new System.ArgumentException("Text and bytes are null");
     }
     this.text = text;
     this.rawBytes = rawBytes;
     this.resultPoints = resultPoints;
     this.format = format;
     this.resultMetadata = null;
 }
Beispiel #4
0
 public Result(String text,
               sbyte[] rawBytes,
               ResultPoint[] resultPoints,
               BarcodeFormat format)
 {
     if (text == null && rawBytes == null)
     {
         throw new ArgumentException("Text and bytes are null");
     }
     this.text           = text;
     this.rawBytes       = rawBytes;
     this.resultPoints   = resultPoints;
     this.format         = format;
     this.resultMetadata = null;
 }
Beispiel #5
0
//JAVA TO C# CONVERTER WARNING: Method 'throws' clauses are not available in .NET:
//ORIGINAL LINE: public com.google.zxing.common.BitMatrix encode(String contents, BarcodeFormat format, int width, int height, java.util.Map<EncodeHintType,?> hints) throws WriterException
        public BitMatrix encode(string contents, BarcodeFormat format, int width, int height, IDictionary <EncodeHintType, object> hints)
        {
            Writer writer;

            switch (format)
            {
            case com.google.zxing.BarcodeFormat.EAN_8:
                writer = new EAN8Writer();
                break;

            case com.google.zxing.BarcodeFormat.EAN_13:
                writer = new EAN13Writer();
                break;

            case com.google.zxing.BarcodeFormat.UPC_A:
                writer = new UPCAWriter();
                break;

            case com.google.zxing.BarcodeFormat.QR_CODE:
                writer = new QRCodeWriter();
                break;

            case com.google.zxing.BarcodeFormat.CODE_39:
                writer = new Code39Writer();
                break;

            case com.google.zxing.BarcodeFormat.CODE_128:
                writer = new Code128Writer();
                break;

            case com.google.zxing.BarcodeFormat.ITF:
                writer = new ITFWriter();
                break;

            case com.google.zxing.BarcodeFormat.PDF_417:
                writer = new PDF417Writer();
                break;

            case com.google.zxing.BarcodeFormat.CODABAR:
                writer = new CodaBarWriter();
                break;

            default:
                throw new System.ArgumentException("No encoder available for format " + format);
            }
            return(writer.encode(contents, format, width, height, hints));
        }
Beispiel #6
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;
        }
Beispiel #7
0
        /// <summary>
        /// Starts the scan : navigates to the scan page and starts reading video stream
        /// Note : Scan will auto-stop if navigation occurs
        /// </summary>
        /// <param name="onBarCodeFound">Delegate Action on a barcode found</param>
        /// <param name="onError">Delegate Action on error</param>
        /// <param name="zxingReader">(optional) A specific reader format, Default will be EAN13Reader </param>
        public static void StartScan(Action<Result> onBarCodeFound, Action<Exception> onError, BarcodeFormat barcodeFormat = null)
        {
            
            var _mainFrame = Application.Current.RootVisual as PhoneApplicationFrame;
            if (_mainFrame != null)
            {
                if (barcodeFormat == null)
                {
                    barcodeFormat = BarcodeFormat.ALL_1D;
                }
                _onBarCodeFound = onBarCodeFound;
                _onError = onError;
                _ZXingReader = GetReader(barcodeFormat);

                _mainFrame.Navigate(new Uri("/MVVM/Views/BarCode.xaml", UriKind.Relative));
            }
        }
Beispiel #8
0
        /// <summary>
        /// Starts the scan : navigates to the scan page and starts reading video stream
        /// Note : Scan will auto-stop if navigation occurs
        /// </summary>
        /// <param name="onBarCodeFound">Delegate Action on a barcode found</param>
        /// <param name="onError">Delegate Action on error</param>
        /// <param name="zxingReader">(optional) A specific reader format, Default will be EAN13Reader </param>
        public static void StartScan(Action<string> onBarCodeFound, Action<Exception> onError, BarcodeFormat barcodeFormat = null)
        {
            
            var _mainFrame = Application.Current.RootVisual as PhoneApplicationFrame;
            if (_mainFrame != null)
            {
                if (barcodeFormat == null)
                {
                    barcodeFormat = BarcodeFormat.EAN_13;
                }
                _onBarCodeFound = onBarCodeFound;
                _onError = onError;
                _ZXingReader = GetReader(barcodeFormat);

                _mainFrame.Navigate(new Uri("/WP7.ScanBarCode;component/BarCode.xaml", UriKind.Relative));
            }
        }
 public ByteMatrix encode1(String contents, BarcodeFormat format, int width, int height, Dictionary<object, object> hints)
 {
     if (format == BarcodeFormat.EAN_8)
     {
         return new EAN8Writer().encode1(contents, format, width, height, hints);
     }
     else if (format == BarcodeFormat.EAN_13)
     {
         return new EAN13Writer().encode1(contents, format, width, height, hints);
     }
     else if (format == BarcodeFormat.QR_CODE)
     {
         return new QRCodeWriter().encode1(contents, format, width, height, hints);
     }
     else
     {
         throw new Exception("ArgumentException: No encoder available for format " + format);
     }
 }
 // added by .net follower (http://dotnetfollower.com)
 // public ByteMatrix encode(System.String contents, BarcodeFormat format, int width, int height, System.Collections.Hashtable hints) // commented by .net follower (http://dotnetfollower.com)
 public ByteMatrix encode(System.String contents, BarcodeFormat format, int width, int height, System.Collections.Generic.Dictionary<Object, Object> hints)
 {
     if (format == BarcodeFormat.EAN_8)
     {
         return new EAN8Writer().encode(contents, format, width, height, hints);
     }
     else if (format == BarcodeFormat.EAN_13)
     {
         return new EAN13Writer().encode(contents, format, width, height, hints);
     }
     else if (format == BarcodeFormat.QR_CODE)
     {
         return new QRCodeWriter().encode(contents, format, width, height, hints);
     }
     else
     {
         throw new System.ArgumentException("No encoder available for format " + format);
     }
 }
Beispiel #11
0
 public ByteMatrix encode(System.String contents, BarcodeFormat format, int width, int height, Dictionary <object, object> hints)
 {
     if (format == BarcodeFormat.EAN_8)
     {
         return(new EAN8Writer().encode(contents, format, width, height, hints));
     }
     else if (format == BarcodeFormat.EAN_13)
     {
         return(new EAN13Writer().encode(contents, format, width, height, hints));
     }
     else if (format == BarcodeFormat.QR_CODE)
     {
         return(new QRCodeWriter().encode(contents, format, width, height, hints));
     }
     else
     {
         throw new System.ArgumentException("No encoder available for format " + format);
     }
 }
 // public ByteMatrix encode(System.String contents, BarcodeFormat format, int width, int height, System.Collections.Hashtable hints) // commented by .net follower (http://dotnetfollower.com)
 public ByteMatrix encode(System.String contents, BarcodeFormat format, int width, int height, System.Collections.Generic.Dictionary <Object, Object> hints) // added by .net follower (http://dotnetfollower.com)
 {
     if (format == BarcodeFormat.EAN_8)
     {
         return(new EAN8Writer().encode(contents, format, width, height, hints));
     }
     else if (format == BarcodeFormat.EAN_13)
     {
         return(new EAN13Writer().encode(contents, format, width, height, hints));
     }
     else if (format == BarcodeFormat.QR_CODE)
     {
         return(new QRCodeWriter().encode(contents, format, width, height, hints));
     }
     else
     {
         throw new System.ArgumentException("No encoder available for format " + format);
     }
 }
Beispiel #13
0
 //获取一二维码实际大小
 public System.Drawing.Size GetEncodeSize(System.String contents, BarcodeFormat format, int width, int height, System.Collections.Hashtable hints)
 {
     System.Drawing.Size sz = new System.Drawing.Size(0, 0);
     if (format == BarcodeFormat.EAN_8)
     {
         return(sz);
     }
     else if (format == BarcodeFormat.EAN_13)
     {
         return(sz);
     }
     else if (format == BarcodeFormat.QR_CODE)
     {
         return(new QRCodeWriter().GetEncodeSize(contents, format, width, height, hints));
     }
     else
     {
         throw new System.ArgumentException("No encoder available for format " + format);
     }
 }
 //JAVA TO C# CONVERTER WARNING: Method 'throws' clauses are not available in .NET:
 //ORIGINAL LINE: public com.google.zxing.common.BitMatrix encode(String contents, BarcodeFormat format, int width, int height, java.util.Map<EncodeHintType,?> hints) throws WriterException
 public BitMatrix encode(string contents, BarcodeFormat format, int width, int height, IDictionary<EncodeHintType, object> hints)
 {
     Writer writer;
     switch (format)
     {
       case com.google.zxing.BarcodeFormat.EAN_8:
     writer = new EAN8Writer();
     break;
       case com.google.zxing.BarcodeFormat.EAN_13:
     writer = new EAN13Writer();
     break;
       case com.google.zxing.BarcodeFormat.UPC_A:
     writer = new UPCAWriter();
     break;
       case com.google.zxing.BarcodeFormat.QR_CODE:
     writer = new QRCodeWriter();
     break;
       case com.google.zxing.BarcodeFormat.CODE_39:
     writer = new Code39Writer();
     break;
       case com.google.zxing.BarcodeFormat.CODE_128:
     writer = new Code128Writer();
     break;
       case com.google.zxing.BarcodeFormat.ITF:
     writer = new ITFWriter();
     break;
       case com.google.zxing.BarcodeFormat.PDF_417:
     writer = new PDF417Writer();
     break;
       case com.google.zxing.BarcodeFormat.CODABAR:
     writer = new CodaBarWriter();
     break;
       default:
     throw new System.ArgumentException("No encoder available for format " + format);
     }
     return writer.encode(contents, format, width, height, hints);
 }
Beispiel #15
0
 //获取一二维码实际大小 重载
 public System.Drawing.Size GetEncodeSize(System.String contents, BarcodeFormat format, int width, int height)
 {
     return(GetEncodeSize(contents, format, width, height, null));
 }
 //JAVA TO C# CONVERTER WARNING: Method 'throws' clauses are not available in .NET:
 //ORIGINAL LINE: public com.google.zxing.common.BitMatrix encode(String contents, BarcodeFormat format, int width, int height) throws WriterException
 public BitMatrix encode(string contents, BarcodeFormat format, int width, int height)
 {
     return encode(contents, format, width, height, null);
 }
Beispiel #17
0
//JAVA TO C# CONVERTER WARNING: Method 'throws' clauses are not available in .NET:
//ORIGINAL LINE: public com.google.zxing.common.BitMatrix encode(String contents, BarcodeFormat format, int width, int height) throws WriterException
        public BitMatrix encode(string contents, BarcodeFormat format, int width, int height)
        {
            return(encode(contents, format, width, height, null));
        }
Beispiel #18
0
 //public Result(string text, sbyte[] rawBytes, ResultPoint[] resultPoints, BarcodeFormat format)
 //    : this(text, rawBytes, resultPoints, format, System.currentTimeMillis())
 public Result(string text, sbyte[] rawBytes, ResultPoint[] resultPoints, BarcodeFormat format)
     : this(text, rawBytes, resultPoints, format, CurrentTimeMillis())
 {
 }
 public ByteMatrix encode(System.String contents, BarcodeFormat format, int width, int height)
 {
     return encode(contents, format, width, height, null);
 }
Beispiel #20
0
        //public Result(string text, sbyte[] rawBytes, ResultPoint[] resultPoints, BarcodeFormat format)
        //    : this(text, rawBytes, resultPoints, format, System.currentTimeMillis())

        public Result(string text, sbyte[] rawBytes, ResultPoint[] resultPoints, BarcodeFormat format)
            : this(text, rawBytes, resultPoints, format, CurrentTimeMillis())
        {
        }
 public ByteMatrix encode(System.String contents, BarcodeFormat format, int width, int height)
 {
     return(encode(contents, format, width, height, null));
 }
 public void read(BarcodeFormat format, BitmapImage image, bool pass)
 {
     if (image != null)
     {
         WP7BarcodeManager.ScanMode = format;
         WP7BarcodeManager.ScanBarcode(image, Result, pass);
     }
 }