Exemplo n.º 1
0
 public AtmStateMachine(Money cash)
 {
     _currentState = Initial = new InitialState(this);
     CardInserted  = new CardInserted(this);
     PinEntered    = new PinEntered(this);
     CashWithdrawn = new CashWithdrawn(this);
     CashAmount    = cash;
 }
Exemplo n.º 2
0
 private void OnCardInserted()
 {
     lock (_syncLocker)
     {
         _isCardHere = true;
         var value = TryInvokeCardAction(ReadData);
         CardInserted?.Invoke(this, new CardInsertedEventArgs {
             Value = value
         });
     }
 }
Exemplo n.º 3
0
        private void OnCardInserted(object sender, CardInsertedEventArgs e)
        {
            Student student = null;

            if (e.Value.HasValue)
            {
                student = _studentsRepository.Get(e.Value.Value);
            }

            CardInserted?.Invoke(this, new StudentCardEventArgs
            {
                Student      = student,
                IsSuccess    = student != null,
                ErrorMessage = e.Value.HasValue
                    ? (e.Value == UnbindStudentId
                        ? "Карта ни к кому не привязана"
                        : $"Ученик с ID = {e.Value} не найден")
                    : "Ошибка чтения карты, попробуйте снова"
            });
        }
Exemplo n.º 4
0
 public void HandleCardInserted(CardInserted message)
 {
     EventAggregator.Publish(message, Execute.OnUIThread);
 }