protected override void OnActivityResult(int requestCode, Result resultCode, Intent data) { base.OnActivityResult(requestCode, resultCode, data); // Feel free to extend the CreditCard_PCL object to include more than what's here. CreditCard_PCL ccPCL = new CreditCard_PCL(); if (data != null) { // Be sure to JavaCast to a CreditCard (normal cast won't work) var card = data.GetParcelableExtra(CardIOActivity.ExtraScanResult).JavaCast <CreditCard> (); Console.WriteLine("Scanned: " + card.RedactedCardNumber); ccPCL.cardNumber = card.CardNumber; ccPCL.ccv = card.Cvv; ccPCL.expr = card.ExpiryMonth.ToString() + card.ExpiryYear.ToString(); ccPCL.redactedCardNumber = card.RedactedCardNumber; ccPCL.cardholderName = card.CardholderName; Xamarin.Forms.MessagingCenter.Send <CreditCard_PCL> (ccPCL, "CreditCardScanSuccess"); } else { Xamarin.Forms.MessagingCenter.Send <CreditCard_PCL> (ccPCL, "CreditCardScanCancelled"); } }
public void OnScanSucceeded(CreditCard_PCL ccPCL) { if (ScanSucceeded != null) { ScanSucceeded(this, ccPCL); } }
public void OnScanSucceeded(CreditCard_PCL ccPCL) { if (ScanSucceeded != null) { ScanSucceeded(this, ccPCL); } Application.Current.MainPage.Navigation.PopAsync(); }
void Activity_ActivityResult(object sender, ActivityResultEventArgs e) { if (e.Data != null) { var card = e.Data.GetParcelableExtra(CardIOActivity.ExtraScanResult).JavaCast <CreditCard>(); CreditCard_PCL ccPCL = new CreditCard_PCL(); ccPCL.ccv = card.Cvv; ccPage.OnScanSucceeded(ccPCL); Console.WriteLine($"Got result: {card.RedactedCardNumber}"); } }
// not implemented, as I'm not sure how to finish this out in Android. private async void HandleScanSucceeded(object sender, CreditCard_PCL ccPCL) { //txtCreditCardNumber.Text = ccPCL.cardNumber; //await Navigation.PopModalAsync(); }