Skip to content

Instantly share code, notes, and snippets.

@juucustodio
Last active November 3, 2017 12:31
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save juucustodio/b6e12dbc77e145c9cf687920121bb4cf to your computer and use it in GitHub Desktop.
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
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