Example #1
0
 /// <summary>
 /// 循环扫描
 /// </summary>
 private void DateCollect()
 {
     while (m_bRunning)
     {
         try
         {
             if (this.tbCardNo.Text == "")
             {
                 System.Threading.Thread.Sleep(400);
                 m_Reader.ReadData();
                 if (m_Reader.CardNo != null && !m_Reader.CardNo.Trim().Equals(""))
                 {
                     m_BindData2GridDelegate = new BindData2GridDelegate(BindData2Grid);
                     Invoke(m_BindData2GridDelegate);
                     m_preReadTime = DateTime.Now;
                 }
             }
             else
             {
                 if (m_preReadTime.AddSeconds(30) < DateTime.Now)
                 {
                     m_ClearCardNoDelegate = new ClearCardNoDelegate(clearCardNo);
                     Invoke(m_ClearCardNoDelegate);
                 }
             }
             m_Reader.CardNo = "";
         }
         catch (Exception eex4)
         {
             //MessageBox.Show("请不要长时间放置同一张卡在刷卡器上!");
         }
     }
 }
Example #2
0
        /// <summary>
        /// 循环扫描
        /// </summary>
        private void DateCollect()
        {
            while (m_bRunning)
            {
                try
                {
                    if (this.tbCardNo.Text == "")
                    {
                        System.Threading.Thread.Sleep(400);
                        m_Reader.ReadData();
                        if (m_Reader.CardNo != null && !m_Reader.CardNo.Trim().Equals(""))
                        {
                            m_BindData2GridDelegate = new BindData2GridDelegate(BindData2Grid);
                            Invoke(m_BindData2GridDelegate);
                            m_preReadTime = DateTime.Now;
                        }
                    }
                    else
                    {
                        if (m_preReadTime.AddSeconds(30) < DateTime.Now)
                        {
                            m_ClearCardNoDelegate = new ClearCardNoDelegate(clearCardNo);
                            Invoke(m_ClearCardNoDelegate);
                        }
                    }
                    m_Reader.CardNo = "";
                }
                catch (Exception eex4)
                {
                    //MessageBox.Show("请不要长时间放置同一张卡在刷卡器上!");
                }

            }
        }