afriscic / BarcodeScanning.Native.Maui

Barcode scanning library for .NET MAUI
https://www.nuget.org/packages/BarcodeScanning.Native.Maui
MIT License
159 stars 31 forks source link

Barcode Decode #83

Open jaberlinz opened 1 month ago

jaberlinz commented 1 month ago

Hi & Thanks for the nice Work! Forgive my ignorance but I have to ask, does this librarry only detect barcodes or it does decode the detected barcode? I dont see where it shows value/ or equivalent string. thnx in advance 4ur help! Cheers!

Olaf-R commented 1 month ago

Wouldn't make all too much sense without the results, would it? :-) Just take a more thorough look at the sample repository and its code, you'll find the results in the BarcodeResult[] array.

afriscic commented 1 month ago

Hello.

Easiest way is to listen to OnDetectionFinished event in code behind. You can then access the decoded string for each detected barcode using DisplayValue or RawValue properties. For example:

private void CameraView_OnDetectionFinished(object sender, OnDetectionFinishedEventArg e)
{
    foreach (var result in e.BarcodeResults)
    {
        var value = result.DisplayValue
        ...
    }
}