コード例 #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;
 }
コード例 #2
0
ファイル: PostMan.cs プロジェクト: ammogcoder/xamarin
        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.");
        }
コード例 #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);
     }
 }