Exemplo n.º 1
0
        private async Task DoSetPin(ISmartCardAdmin smartCard)
        {
            await smartCard.SetUserPin(CurrentStateService.Instance.Pin, CurrentStateService.Instance.Data);

            AppendText("PIN set");

            // read the data back
            var sc   = SmartCardFactory.GetSmartCardForValidation(CurrentStateService.Instance.Pin);
            var data = await sc.GetData();

            AppendText("Verified: " + data + " was written to the card.");
        }
Exemplo n.º 2
0
        private async Task DoSetPin(ISmartCardAdmin smartCard)
        {
            await smartCard.SetUserPin(GateKey, TicketState.Instance.TicketData);

            AppendText("data set");

            // read the data back
            var sc   = SmartCardFactory.GetSmartCardForValidation(GateKey);
            var data = await sc.GetData();

            AppendText("Verified: " + data + " was written to the card.");
        }
Exemplo n.º 3
0
        private async void HandleCard()
        {
            var success = true;

            try
            {
                switch (mode)
                {
                case CardMode.SetPin:
                    AppendText("New PIN", false);
                    await OnNewPin(SmartCardFactory.GetSmartCardForProvisioning(MasterKey));

                    break;

                case CardMode.ReadData:
                    AppendText("Validate PIN", false);
                    await OnValidatePin(SmartCardFactory.GetSmartCardForValidation(CurrentStateService.Instance.Pin));

                    break;

                case CardMode.Reset:
                    await ResetToDefault(SmartCardFactory.GetSmartCardForProvisioning(MasterKey));

                    break;

                default:
                    throw new ArgumentOutOfRangeException();
                }
            }
            catch (Exception e)
            {
                success = false;
                Debug.WriteLine(e);

                AppendText(e.ToString());
            }

            if (success)
            {
                AppendText("Complete");
            }

            QuitButton.IsEnabled = true;
        }
Exemplo n.º 4
0
        private async void HandleCard()
        {
            var success = true;

            try
            {
                switch (mode)
                {
                case Mode.Cashier:
                    AppendText("Set Data", false);
                    await OnNewPin(SmartCardFactory.GetSmartCardForProvisioning(MasterKey));

                    break;

                case Mode.SkiLift:
                    AppendText("Validate PIN", false);
                    await OnValidateData(SmartCardFactory.GetSmartCardForValidation(GateKey));

                    break;

                case Mode.Reset:
                    await ResetToDefault(SmartCardFactory.GetSmartCardForProvisioning(MasterKey));

                    break;

                default:
                    throw new ArgumentOutOfRangeException();
                }
            }
            catch (Exception e)
            {
                success = false;
                Debug.WriteLine(e);

                AppendText(e.ToString());
            }

            if (success)
            {
                AppendText("Complete");
            }
        }