void CardConnectedCallback(SCardChannel cardChannel)
        {
            /* The CardConnected function is called as a delegate (callback) by the SCardReader object */
            /* within its backgroung thread. Therefore it is not allowed to use the UI objects.        */

            Logger.Trace("Card connected - Trying to run the transaction");


            if (!AppleVasLicense.ReadDeviceId(cardChannel))
            {
                Logger.Error("Read device ID error");
                ShowResult("Not a SpringCard device?", null, true);
                return;
            }

            if (!AppleVasLicense.Allowed(out string msg2))
            {
                Logger.Error("Not allowed to execute");
                ShowResult(string.Format("Not allowed to execute ({0})", msg2), null, true);
                return;
            }

            AppleVasTerminal terminal = new AppleVasTerminal();

            foreach (AppleVasConfig merchConfig in appleConfig.Merchants)
            {
                terminal.AddConfig(merchConfig);
            }

            if (terminal.DoTransaction(cardChannel, out AppleVasData data, out AppleVasError error))
            {
                ShowResult(null, data, true);
            }
        void CardConnectedCallback(SCardChannel cardChannel)
        {
            /* The CardConnected function is called as a delegate (callback) by the SCardReader object */
            /* within its backgroung thread. Therefore it is not allowed to use the UI objects.        */


            /* Apple exhange */

            if (!AppleVasLicense.ReadDeviceId(cardChannel))
            {
                Logger.Error("Read device ID error");
                ShowResult("Not a SpringCard device?");
                return;
            }

            if (!AppleVasLicense.Allowed(out string msg2))
            {
                Logger.Error("Not allowed to execute");
                ShowResult(string.Format("Not allowed to execute ({0})", msg2));
                return;
            }

            AppleVasTerminal appleTerminal = new AppleVasTerminal();

            foreach (AppleVasConfig merchConfig in appleConfig.Merchants)
            {
                appleTerminal.AddConfig(merchConfig);
            }

            if (appleTerminal.DoTransaction(cardChannel, out AppleVasData data2, out AppleVasError error2, out RAPDU selectOseresponseApple))
            {
                ShowResult("Apple Wallet\n" + data2.Text);
                Task.Delay(5000).ContinueWith(t => resetUiEvent());
                return;
            }

            if (!GoogleVasLicense.ReadDeviceId(cardChannel))
            {
                Logger.Error("Read device ID error");
                ShowResult("Not a SpringCard device?");
                return;
            }

            if (!GoogleVasLicense.LoadCollectorId(googleConfig.CollectorId_4))
            {
                Logger.Error("Wrong Collector ID");
                ShowResult("Wrong Collector ID?");
                return;
            }

            if (!GoogleVasLicense.Allowed(out string msg1))
            {
                Logger.Error("Not allowed to execute");
                ShowResult(string.Format("Not allowed to execute ({0})", msg1));
                return;
            }

            Logger.Trace("Card connected - Trying to run the transaction");

            /* Google exhange */

            GoogleVasTerminal googleTerminal = new GoogleVasTerminal(googleConfig);

            /* Provide selectOseResponseApple to speed up the transaction */
            if (googleTerminal.DoTransaction(cardChannel, out GoogleVasData data1, out GoogleVasError error1, selectOseresponseApple))
            {
                /* Convert JSON to SpringPass data with regex */
                Regex rx = new Regex(@"[0-9a-zA-Z]+\|[a-z0-9.-_]+@[a-z.]+", RegexOptions.Compiled | RegexOptions.IgnoreCase);

                MatchCollection matches = rx.Matches(data1.GetJsonString());

                if (matches.Count >= 1)
                {
                    ShowResult("Google Smart Tap\n" + matches[0].Value);
                    Task.Delay(5000).ContinueWith(t => resetUiEvent());
                }
                else
                {
                    ShowResult("Read succeded but no SpringPass data found");
                }
                return;
            }
        }