//读卡 public IDCard ReadCard(IDCard IC) { try { iConnectionState = IC.InitComm(); if (iConnectionState == 1) { int iResult = 0; while (iResult != 2) { iResult = IC.ReadCardContent(); Thread.Sleep(100); } } else { IC = null; } } catch (Exception ex) { IC = null; LogImpl.Error(string.Format("{0}{2}{1}", ex.StackTrace, ex.Message, System.Environment.NewLine)); } return(IC); }
private void IdCardDetected(HardWare.CardReader.IDCard idCard) { Logger.Debug("开始读卡"); if (idCard != null) { loginVM.Name = idCard.Name; loginVM.Sex = idCard.Sex; loginVM.Nation = idCard.Nation; loginVM.Address = idCard.Address; loginVM.IDCode = idCard.IDCode; Dispatcher.Invoke(DispatcherPriority.Normal, new Action(() => { imgPhoto.Source = GetMemoryBmp("{AppDomain.CurrentDomain.BaseDirectory}{zp.bmp}"); })); Thread.Sleep(2000); string examineeId; //TODO 暂注释 (查询数据库判断是否有可以考试) //var canExam = CanExam(idCard.IDCode, out examineeId); var canExam = true; if (canExam) { //loginVM.ExamineeID = examineeId; loginVM.ExamineeID = String.Empty;//考生号 Dispatcher.Invoke(DispatcherPriority.Normal, new Action(() => this.ParentWindow().StepToExamIntroductionPage())); } else { Dispatcher.Invoke(DispatcherPriority.Normal, new Action(() => { TipWindow.ShowTip("未安排在此考试\n请联系考务人员解决", ClearPage); })); StartDetect(); } } }