我试图制作一个使用Xamarin和ZXing读取涉及网站地址的二维码的应用程序,并在成功读取二维码后打开浏览器中的链接。但是我的问题是:在浏览器中打开链接并返回到QR阅读器应用程序后(通过后退按钮或使用主页按钮关闭浏览器),我的应用程序无法再阅读其他QR码。(“阅读QR文件一旦通过浏览器进入网站,返回浏览器并继续阅读qr并打开它们”是我试图达到的目标
到目前为止我尝试过的是什么
我如何使qr阅读器在读取一次并对其采取行动后才能读取另一张qr。预先感谢
ps:我关注了Redth的github文件以及其他实现此问题的人
mainpage.xaml.cs中的代码
public partial class MainPage : ContentPage
{
public MainPage()
{
InitializeComponent();
}
public void scanView_OnScanResult(ZXing.Result result)
{
if (result.Text != null && result.Text.Contains("ramakbilisim"))
{
Browser.OpenAsync(result.Text,BrowserLaunchMode.SystemPreferred);
}
}
protected override void OnAppearing()
{
base.OnAppearing();
scanView.IsScanning = true;
}
protected override void OnDisappearing()
{
base.OnDisappearing();
scanView.IsScanning = false;
}
}
mainpage.xaml中的代码
<ContentPage xmlns="http://xamarin.com/schemas/2014/forms"
xmlns:x="http://schemas.microsoft.com/winfx/2009/xaml"
xmlns:d="http://xamarin.com/schemas/2014/forms/design"
xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006"
xmlns:zxing="clr-namespace:ZXing.Net.Mobile.Forms;assembly=ZXing.Net.Mobile.Forms"
mc:Ignorable="d"
x:Class="RamakDenemeQr.MainPage">
<StackLayout Padding="0,0,0,10">
<Frame BackgroundColor="#2196F3" Padding="24" CornerRadius="0">
<Label Text="Ramak Deneme Qr" HorizontalTextAlignment="Center" TextColor="White" FontSize="36"/>
</Frame>
<zxing:ZXingScannerView
x:Name="scanView"
OnScanResult="scanView_OnScanResult"
IsScanning="False"
WidthRequest="300"
HeightRequest="400"
VerticalOptions="CenterAndExpand"
HorizontalOptions="CenterAndExpand"
/>
</StackLayout>