How do I restart the barcode scanner (Barcode Scanner.Mobile.Maui)?

99 Views Asked by At

I have the DotNet Maui app. It contains a barcode scanner (BarcodeScanner.Mobile.Maui). When I go to the (Achats) page (Shell) and return to the (Vente) page (Shell) that contains the scanner code bar, I find that it does not work or is inactive, as shown in the image below. How can I solve the problem?

My code xaml:

<gv:CameraView 
    HorizontalOptions="FillAndExpand"
    VerticalOptions="FillAndExpand"
    OnDetected="CameraView_OnDetected" 
    TorchOn="False"
    VibrationOnDetected="False"
    ScanInterval="50"
    x:Name="cameraScanner"
/>     

image 1

image 2

I searched the internet and did not find a suitable solution. I tried cameraScanner.Scanning = true;

1

There are 1 best solutions below

2
Link686 On BEST ANSWER

try to use this

private void MudarCamera_Clicked(object sender, EventArgs e)
{
    Camera.CameraFacing = Camera.CameraFacing == CameraFacing.Back ? CameraFacing.Front : CameraFacing.Back;
}

create a button that does this action, that's what worked for me