Esempio n. 1
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;
        }
Esempio n. 2
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");
            }
        }