private void DecodeThreadMethod() { string decoderesult = null; while (bIsLoop) { if (skipCode) { //other thread is busy processing last code //do nothing } else { decoderesult = Decoder(); if (decoderesult != null) { Api.beepControl(1); OnCodeFound(new QRcodeScannerEventArgs(decoderesult)); decoderesult = null; } } } }
void timer_Elapsed(object sender, System.Timers.ElapsedEventArgs e) { Stop(); try { string result = Decoder(); if (string.IsNullOrEmpty(result)) { } else { objVbarapi.beepControl(1); //string CardNo = AESAlgorithm.AESDecrypt(result); string[] arr = result.Split('&'); string[] arr1 = arr[1].Split('='); string cardNo = arr1[1]; //验证卡号 ReaderInfo reader = new SeatManage.Bll.T_SM_Reader().GetReader(cardNo); if (!string.IsNullOrEmpty(reader.Name)) { CardNoGeted(this, new SeatManage.ISystemTerminal.IPOS.CardEventArgs(cardNo, true, null)); } else { SeatManage.SeatManageComm.WriteLog.Write("扫码结果:" + result + "学号不存在"); } //CardNoGeted(this, new SeatManage.ISystemTerminal.IPOS.CardEventArgs(cardNo, true, null)); // SeatManage.SeatManageComm.WriteLog.Write("扫码结果:" + result); } //objVbarapi.disConnected(); //string cardId = cardReader.GetCardId(); ////获取到信息,读卡器响 //if (!string.IsNullOrEmpty(cardId)) //{ // SeatManage.SeatManageComm.WriteLog.Write(cardId); // string cardNo = GetCardNo(cardId.ToUpper()); // if (!string.IsNullOrEmpty(cardNo) && CardNoGeted != null) // { // CardNoGeted(this, new SeatManage.ISystemTerminal.IPOS.CardEventArgs(cardNo, true, null)); // } // else // if (string.IsNullOrEmpty(cardNo)) // { // cardReader.Beep(); // } //} } catch (Exception ex) { SeatManage.SeatManageComm.WriteLog.Write(ex.ToString()); } finally { Start(); } }