await DisplayAlert("xxx.com", "button press", "OK");
try
{
ZXing.Mobile.MobileBarcodeScanningOptions opt = new ZXing.Mobile.MobileBarcodeScanningOptions
{
PossibleFormats=new List<ZXing.BarcodeFormat>
{
ZXing.BarcodeFormat.QR_CODE
}
};
scanPage = new ZXingScannerPage(opt);
}
catch (Exception ex) {
await DisplayAlert("xxx.com", ex.Message.ToString(), "OK");
}
scanPage.OnScanResult += (result) => {
scanPage.IsScanning = false;
Device.BeginInvokeOnMainThread (async() => {
string qrcode = result.Text.Replace("http://www.xxx.com/qr/", "");
//DisplayAlert("Scanned Barcode", result.Text, "OK");
IIC iic = new IIC();
string j = iic.GetChoices(qrcode);
Debug.WriteLine(j);
//DisplayAlert("xxx.com", j, "Ok");
if ((j == "null") || (string.IsNullOrEmpty(j)) || (j == ""))
{
//do something with empty
await DisplayAlert("Alert", "No choices for this code", "OK");
}
else
{
Newtonsoft.Json.Linq.JArray choices = Newtonsoft.Json.Linq.JArray.Parse(j);
//await DisplayAlert("xxx.com", choices.ToString(), "Ok");
cp = new Choices(choices);
//Device.BeginInvokeOnMainThread(() => {
//Navigation.PopAsync();
Navigation.RemovePage(scanPage);
await Navigation.PushAsync(cp); //});
}
//await DisplayAlert("xxx.com", iic.Scan(3), "Ok");
});
};
await Navigation.PushAsync (scanPage);
};