Esempio n. 1
0
 void cardInit()
 {
     if (CardTools.connect() == false)
     {
         init_zt          = false;
         label_zt.Content = "读卡器连接失败!";
     }
 }
Esempio n. 2
0
 void readCard(TextBox textbox)
 {
     try
     {
         textbox.Text = CardTools.scanCard().ToString().Trim();
         CardTools.readCardMessage();
     }
     catch
     {
         MessageBox.Show("读卡失败!");
     }
 }
Esempio n. 3
0
 private void but_read_Click(object sender, RoutedEventArgs e)
 {
     try
     {
         text_cardid.Text = CardTools.scanCard().Trim();
         CardTools.readCardMessage();
     }
     catch
     {
         MessageBox.Show("读卡失败!");
     }
 }
Esempio n. 4
0
 void timerInit()//时钟初始化
 {
     selectTimer          = new DispatcherTimer();
     selectTimer.Interval = TimeSpan.FromMilliseconds(100);
     selectTimer.Tick    += new EventHandler((obj, eve) =>
     {
         try
         {
             cardID = CardTools.scanCard().Trim();//读卡操作
         }
         catch
         {
             cardID = null;
         }
         if (cardID != null && cardID != "")
         {
             string name = DbTools.sqlSelectUserAndInsertMessage(cardID, DateTime.Now);
             CardTools.readCardMessage();
             if (name != "非法卡")
             {
                 mTimer.Start();
                 label_zt.Content = "欢迎打卡:" + name;
             }
             else
             {
                 label_zt.Content = "非法卡,不与进入!";
             }
             cardID = null;
         }
     });
     mTimer          = new DispatcherTimer();
     mTimer.Interval = TimeSpan.FromMilliseconds(10);
     mTimer.Tick    += new EventHandler((obj, eve) =>
     {
         //门禁动画
         if (i <= 500)
         {
             i++;
         }
         if (i == 1)
         {
             selectTimer.Stop();
             openZigbee();
         }
         if (i <= 100)
         {
             grid_lm.Margin = new Thickness(134 - i, 41, 0, 0);
             grid_rm.Margin = new Thickness(263 + i, 41, 0, 0);
         }
         else
         if (i == 500)
         {
             i = 0;
             mTimer.Stop();
             grid_lm.Margin = new Thickness(134, 41, 0, 0);
             grid_rm.Margin = new Thickness(263, 41, 0, 0);
             selectTimer.Start();
             closeZigBee();
         }
     });
     #endregion
 }