Hi All,
I have a Xamarin.Forms projects, and I am doing Card.IO stuff.
Now I have a problem with DependencyService returning values, stuck here for the whole day.
Code is here>
In PCL, when Clicking button, PCL using dependencyService to scan the credit card,
void button_Clicked(object sender, EventArgs e)
{
var result = DependencyService.Get<ICardIO>().Scan();
}
In iOS project, I can get card number, the code shows as below, but how should I do to get the card number in PCL project?
public CardResult Scan()
{
var appcontroller = UIApplication.SharedApplication.KeyWindow.RootViewController;
var paymentDelegate = new MyPaymentDelegate();
var paymentViewController = new CardIOPaymentViewController(paymentDelegate);
paymentViewController.CollectCVV = false;
paymentViewController.CollectExpiry = true;
appcontroller.PresentViewController(paymentViewController, true, null);
paymentDelegate.OnScanCompleted += (viewController, cardInfo) =>
{
Result = new CardIOResult();
Result.CardNumber = cardInfo.CardNumber; // I can get card number here , but how to return it to the PCL?
};
return this.Result;
}
Thanks