Esempio n. 1
0
 private void ReadTask()
 {
     results = barcodeReader.DecodeImage(uiImage, "", out error);
     if (results != null && results.Length > 0)
     {
         for (int i = 0; i < results.Length; i++)
         {
             if (i == 0)
             {
                 result = "Code[1]: " + results[0].BarcodeText;
             }
             else
             {
                 result = result + "\n\n" + "Code[" + (i + 1) + "]: " + results[i].BarcodeText;
             }
         }
         //Console.WriteLine(results[0].BarcodeText);
     }
     else
     {
         result = "";
     }
     DispatchQueue.MainQueue.DispatchAsync(update);
     context.Dispose();
     cgImage.Dispose();
     uiImage.Dispose();
     ready = true;
 }
Esempio n. 2
0
        public string getResult()
        {
            string path = NSBundle.MainBundle.PathForResource("qr", "PNG");

            UIKit.UIImage image = new UIKit.UIImage(path);
            results = reader.DecodeImage(image, "", out error);
            if (results != null && results.Length > 0)
            {
                return(results[0].BarcodeText);
            }
            return("Barcode not found.");
        }
Esempio n. 3
0
 partial void OnReadBtnClick(UIButton sender)
 {
     if (haveRead)
     {
         label.Text = "";
         haveRead   = false;
         readBtn.SetTitle("Read", UIControlState.Normal);
     }
     else
     {
         Foundation.NSError     error         = new Foundation.NSError();
         DynamsoftBarcodeReader barcodeReader = new DynamsoftBarcodeReader("");
         iTextResult[]          result        = barcodeReader.DecodeImage(qrimage.Image, "", out error);
         label.Text = result[0].BarcodeText;
         readBtn.SetTitle("Reset", UIControlState.Normal);
     }
 }