Skip to content

Instantly share code, notes, and snippets.

@pictos
Last active March 2, 2018 21:31
Show Gist options
  • Save pictos/bcebd7227852a0aa4a3fa3495b38a067 to your computer and use it in GitHub Desktop.
Save pictos/bcebd7227852a0aa4a3fa3495b38a067 to your computer and use it in GitHub Desktop.
using System.Threading.Tasks;
using App6.Droid.Servicos;
using App6.Interfaces;
using Xamarin.Forms;
using ZXing.Mobile;
[assembly: Dependency(typeof(Scanner))]
namespace App6.Droid.Servicos
{
public class Scanner : IScan
{
public async Task<string> ScanAsync()
{
var opcao = new MobileBarcodeScanningOptions();
opcao.PossibleFormats.Clear();
opcao.PossibleFormats.Add(ZXing.BarcodeFormat.QR_CODE);
var scanner = new MobileBarcodeScanner
{
TopText = "Scaneando o QRCode",
UseCustomOverlay = false
};
var resultadoScan = await scanner.Scan(opcao);
return resultadoScan.Text;
}
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment