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} не найден") : "Ошибка чтения карты, попробуйте снова" }); }