Skip to content

Instantly share code, notes, and snippets.

@pictos
Last active March 2, 2018 21:32
Show Gist options
  • Save pictos/100667d7c4a9c9afe1af58c66a2763fe to your computer and use it in GitHub Desktop.
Save pictos/100667d7c4a9c9afe1af58c66a2763fe to your computer and use it in GitHub Desktop.
using App6.Interfaces;
using System.Threading.Tasks;
using Xamarin.Forms;
namespace App6.ViewModels
{
public class ScanViewModel : BaseViewModel
{
public Command ScanCommand { get; }
public ScanViewModel()
{
ScanCommand = new Command(async () => await ExecuteScanCommand());
}
async Task ExecuteScanCommand()
{
var scanner = DependencyService.Get<IScan>();
var result = await scanner.ScanAsync();
if (result != null)
await DisplayAlert("Resultado", result, "Ok");
}
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment