Last active
November 3, 2017 12:31
-
-
Save juucustodio/b6e12dbc77e145c9cf687920121bb4cf to your computer and use it in GitHub Desktop.
Exemplo de como criar um barcode scanner com Xamarin.Forms http://julianocustodio.com/scanner
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
private void OpenScanner(object sender, EventArgs e) | |
{ | |
Scanner(); | |
} | |
public async void Scanner() | |
{ | |
var ScannerPage = new ZXingScannerPage(); | |
ScannerPage.OnScanResult += (result) => { | |
// Parar de escanear | |
ScannerPage.IsScanning = false; | |
// Alert com o código escaneado | |
Device.BeginInvokeOnMainThread(() => { | |
Navigation.PopAsync(); | |
DisplayAlert("Código escaneado", result.Text, "OK"); | |
}); | |
}; | |
await Navigation.PushAsync(ScannerPage); | |
} | |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment