2017-07-18 132 views

答えて

0

あなたのInitializeScannerメソッドは以下のようにスキャナの初期化を行うことができ、私の場合はバーコードとQRコードの両方をサポートしたいと考えています。スキャンオプションQRCodeをサポートしない場合は、スキャンオプションQRCodeを削除することができます。 スキャナがコードを認識して一意の文字列を返すときに、初期化がコールバックされる間にコールバックが記述されています。 スキャナオプションは、プロパティUseFrontCameraIfAvailable MobileBarcodeScanningOptionsクラスで真UseFrontCameraIfAvailable =のプロパティを設定し

var mobileBarcodeScanningOptions= new ZXing.Mobile.MobileBarcodeScanningOptions(); 
     mobileBarcodeScanningOptions.UseFrontCameraIfAvailable = true; 
     mobileBarcodeScanningOptions.PossibleFormats = new List<ZXing.BarcodeFormat>() { 
     ZXing.BarcodeFormat.CODE_128, 
     ZXing.BarcodeFormat.CODE_93, 
     ZXing.BarcodeFormat.CODE_39, 
     ZXing.BarcodeFormat.PDF_417, 
     ZXing.BarcodeFormat.QR_CODE 
     }; 
     mobileBarcodeScanningOptions.AutoRotate = false; 
     mobileBarcodeScanningOptions.TryHarder = true; 
     mobileBarcodeScanningOptions.TryInverted = false; 
     var scanview = new ZXingScannerView(new CGRect(0, 0, View.Frame.Width, View.Frame.Height)) { } 
     scanview.AutoFocus(); 

     //code to add your scanview in your main view 
     scanview.StartScanning(MyScanResultHandler, mobileBarcodeScanningOptions); 


//After scanning code, scanner callbacks below method 

    private void MyScanResultHandler(Result obj) 
    { 
     if (obj != null) 
     { 
      //obj.Text gives you value of code in string which you can use further in your application 
     }   

    } 
関連する問題