为什么 zxing scanner 会多次读取二维码?

Why zxing scanner read qr code several times?

我只想打开二维码阅读的新页面,但是命令启动了两次

我该如何解决?

命令:

scanCommand = new RelayCommand(obj =>
                  {
                      _ = navigation.PushAsync(new TestPage1());
                  });

扫描仪:

<zxing:ZXingScannerView 
       ScanResultCommand="{Binding ScanCommand}"
       IsScanning="{Binding IsScanning}"
       WidthRequest="300" HeightRequest="300"
       VerticalOptions="CenterAndExpand"
       HorizontalOptions="CenterAndExpand"/>
    <zxing:ZXingDefaultOverlay BottomText="Align the code inside the frame"/>

据我所知,Zxing扫描仪会一直扫描。

您可以在您的命令中将 IsScanning 属性 设置为 false。

scanCommand = new RelayCommand(obj =>
    {
        IsScanning=false;
        _ = navigation.PushAsync(new TestPage1());
    });