public AtmStateMachine(Money cash) { _currentState = Initial = new InitialState(this); CardInserted = new CardInserted(this); PinEntered = new PinEntered(this); CashWithdrawn = new CashWithdrawn(this); CashAmount = cash; }
private void OnCardInserted() { lock (_syncLocker) { _isCardHere = true; var value = TryInvokeCardAction(ReadData); CardInserted?.Invoke(this, new CardInsertedEventArgs { Value = value }); } }
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} не найден") : "Ошибка чтения карты, попробуйте снова" }); }
public void HandleCardInserted(CardInserted message) { EventAggregator.Publish(message, Execute.OnUIThread); }