private void CardInserted(object sender, CardInsertedEventArgs e) { if (!e.Value.HasValue) { MessageBox.Show("Ошибка контакта с картой. Попробуйте снова."); return; } synchronizationContext.Post(new SendOrPostCallback(o => { int id = (int)o; if (id == 0) { labelRead.Text = "<Пустая карта>"; return; } using (var db = new SportEntities(SportProgramSettings.ConnectionString)) { Students student = db.Students.Find(id); labelRead.Text = student == null ? $"Ученика с ID == {id} не существует" : $"(Ид {student.StudentId}) {student.FirstName} {student.MiddleName} {student.LastName}"; } }), e.Value.Value); }
private void CardInserted(object sender, CardInsertedEventArgs e) { if (!e.Value.HasValue) { MessageBox.Show("Ошибка контакта с картой. Попробуйте снова."); return; } synchronizationContext.Post(o => SetCurrentStudent((int)o), e.Value.Value); }
private static void Listener_CardInserted(object sender, CardInsertedEventArgs e) { if (e.Value.HasValue) { Log(ConsoleColor.DarkGreen, $"[LOAD] Карта c ID == {e.Value}"); } else { Log(ConsoleColor.DarkRed, "[LOAD] Не удалось считать значение карты"); } }
private void CardInserted(object sender, CardInsertedEventArgs e) { if (!e.Value.HasValue) { MessageBox.Show("Ошибка контакта с картой. Попробуйте снова."); return; } _smartReader.WriteValue(NewValue); synchronizationContext.Post(o => Close(), e.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} не найден") : "Ошибка чтения карты, попробуйте снова" }); }