Riccardo Daria

Riccardo Daria

  • 1.3k
  • 74
  • 5.2k

zXing XAMARINE doesn't scan if you reOpen the page

May 26 2023 7:10 AM

i use this code:

<Label x:Name="scanResultText" />
<zxing:ZXingScannerView IsScanning="True"   OnScanResult="ZXingScannerView_OnScanResult" x:Name="fotoCamera" />
<Button Text="" Clicked="AvviaScanner" />
</StackLayout>
using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using Xamarin.Forms;
namespace UBIK_Beauty_app
{
    public partial class PageScanner : ContentPage
    {
        public PageScanner()
        {
            InitializeComponent();
        }
        void ZXingScannerView_OnScanResult(ZXing.Result result)
        {
            Device.BeginInvokeOnMainThread(() =>
            {
                scanResultText.Text = result.Text + " (type: " + result.BarcodeFormat.ToString() + ")";
                Application.Current.MainPage.Navigation.PopAsync();
            });
        }
        private void AvviaScanner(object sender, EventArgs args)
        {
            //fotoCamera.IsVisible = true;
           // fotoCamera.IsScanning = true;
        }
    }
}

it works only the first time you open the page, if you, 

after you get the barCode by scanning, go to previuos page and then reOpen this page the camera doesn'TSCAN!!!!!!

Why don't you tray and help me????

THANKS


Answers (3)