Esempio n. 1
0
        /// <summary>
        /// 扫码进入闸机流程
        /// </summary>
        /// <param name="sender"></param>
        /// <param name="e"></param>
        private void EntryByCodeProcess(object sender, TX400Scanner.QRcodeScannerEventArgs e)
        {
            //scanner is trigged, lock the system 3s
            if (sysIsLock == false)
            {
                //lock the scanner in case this process is interrupted
                scanner.Lock();
                logger.Info("Recieved code=" + e.Code);
                logger.Trace("Lock QR code scanner started " + DateTime.Now.ToString());

                char[] trimchars = new char[2] {
                    '\0', ' '
                };
                string trimcode = e.Code.Trim(trimchars);

                APIClient.Code code = new APIClient.Code()
                {
                    code = trimcode
                };

                APIClient.UserInfo userinfo = client.EntryByCode(code);
                if (userinfo.nickName != string.Empty)
                {
                    SetTileButton(tileBtn, userinfo);
                    SetTileButtonVisable(tileBtn, true);
                    SetPictureBox(pictureBoxCenter, new Bitmap("success.gif"));
                    SetPictureBoxVisibility(loadBox_small, false);
                    SetMessageLabel(bunifuCustomLabel1, code_identify_success_str);

                    OpenGate();

                    PlayWelcomSound(userinfo.nickName);

                    APIClient.Log log = new APIClient.Log()
                    {
                        who   = userinfo.id,
                        where = shopid
                    };

                    client.VistLogToSystem(log);

                    //success code will lock the system for 3s
                    LockSystem();

                    //clear textbox
                    SetDataText(richTextBox1, string.Empty);
                }
                else
                {
                    //服务器没有返回用户信息
                    //todo:提示QRcode错误
                    logger.Error("Server return unvalid user info, QR code Error");
                    scanner.Unlock();
                }
            }
            else
            {
                //skip this scan result if system is lockeds
            }
        }
Esempio n. 2
0
 /// <summary>
 /// 接收到扫描QR码事件发生时调用函数
 /// </summary>
 /// <param name="sender"></param>
 /// <param name="e"></param>
 private void ShowCodeInTextBox(object sender, TX400Scanner.QRcodeScannerEventArgs e)
 {
     //richTextBox1.Text = e.Code.ToString();
     SetDataText(richTextBox1, e.Code.ToString());
 }