Example #1
0
 //读卡
 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);
 }
Example #2
0
 private static void ReadInternel(object state)
 {
     while (CanRead)
     {
         if (wrapper.ReadCardContent() != 2)
         {
             Thread.Sleep(300);
         }
         else
         {
             OnIdCardDetected();
             break;
         }
     }
     Reading = false;//读取完成
 }