私はVisual Studio上でUWP、Android、IOSのXamarinフォームでモバイルアプリケーションを開発しています。ZXing.Mobile.MobileBarcodeScanner.Cancel()not working
私は現在、自分のコンピュータ(Windows 10)と私の電話(Windows 10)でアプリケーションをテストしています。
私はZxing MobileBarcodeScannerを使用して複数のバーコードをスキャンしています。
私が戻るボタンを押すと、MobileBarcodeScanner.Cancel()が呼び出されます。
カメラを閉じるだけです。それはMobileBarcodeScannerのUIを排除するものではありません。そのための解決策は見つかりませんでした。
誰でも私を助けたり解決策を提案したりできますか?
キャンセルボタンとFlashボタンは、スキャナのUIには表示されません。
コード:
private void showScanner()
{
var scanner = new MobileBarcodeScanner(App.coreDispatcher)
{
UseCustomOverlay = false,
TopText = "Hold camera up to barcode to scan",
BottomText = "Barcode will automatically scan",
CancelButtonText = "Done",
FlashButtonText = "Flash"
}
var opt = new MobileBarcodeScanningOptions { DelayBetweenContinuousScans = 3000 };
scanner.ScanContinuously(opt, HandleScanResult);
}
protected override bool OnBackButtonPressed()
{
scanner.Cancel();
}
private void HandleScanResult(ZXing.Result result)
{
string msg;
if (result != null && !string.IsNullOrEmpty(result.Text)) // Success
{
msg = result.Text;
}
else // Canceled
{
msg = "Scanning Canceled!";
}
}
してください時間。 ZXingScannerPageは毎回単一のスキャンしかサポートしていません。また、MobileBarcodeScannerを処理するZXingScannerPageを作成する方法もありません。私はここで見たようにhttps://github.com/Redth/ZXing.Net.Mobile/issues/366/これはUWPの一般的な問題です – Panayiotis
また、私のコードはこの例に基づいていますhttps://forums.xamarin.com/ディスカッション/ 49643/help-zxing-mobile-scancontinuously – Panayiotis