Exemplo n.º 1
0
        private void OnBarcode(BardCodeHooK.BarCodes barCode)
        {
            if (!barCode.IsValid)
            {
                return;
            }
            var str = barCode.BarCode.Replace("\0", "");

            Console.WriteLine($"{DateTime.Now:MM:dd HH:mm:ss.fff} [{str}]");
        }
Exemplo n.º 2
0
 private void ShowInfo(BardCodeHooK.BarCodes barCode)
 {
     if (this.InvokeRequired)
     {
         this.BeginInvoke(new ShowInfoDelegate(ShowInfo), new object[] { barCode });
     }
     else
     {
         //textBox1.Text = barCode.KeyName;
         //textBox2.Text = barCode.VirtKey.ToString();
         //textBox3.Text = barCode.ScanCode.ToString();
         //textBox4.Text = barCode.Ascll.ToString();
         //textBox5.Text = barCode.Chr.ToString();
         textBox6.Text = barCode.IsValid ? barCode.BarCode : "";//是否为扫描枪输入,如果为true则是 否则为键盘输入
         buttonX2.Focus();
         //textBox7.Text += barCode.KeyName;
         //textBox6.Text = textBox6.Text.Trim().ToUpper();
         //MessageBox.Show(barCode.IsValid.ToString());
     }
 }
Exemplo n.º 3
0
 void BarCode_BarCodeEvent(BardCodeHooK.BarCodes barCode)
 {
     ShowInfo(barCode);
 }
Exemplo n.º 4
0
        //private void ShowInfo(BardCodeHooK.BarCodes barCode)
        //{
        //    //if (barCode.IsValid)
        //    //{
        //    //    textBox1.Text = barCode.KeyName;
        //    //    textBox2.Text = barCode.VirtKey.ToString();
        //    //    textBox3.Text = barCode.ScanCode.ToString();
        //    //    textBox4.Text = barCode.Ascll.ToString();
        //    //    textBox5.Text = barCode.Chr.ToString();
        //    //    textBox6.Text = barCode.IsValid ? barCode.BarCode : "";//是否为扫描枪输入,如果为true则是 否则为键盘输入
        //    //    textBox7.Text += barCode.KeyName;

        //    //}
        //    //MessageBox.Show(barCode.IsValid.ToString());

        //}
        //C#中判断扫描枪输入与键盘输入
        //Private DateTime _dt = DateTime.Now;  //定义一个成员函数用于保存每次的时间点
        //private void textBox1_KeyPress(object sender, KeyPressEventArgs e)
        //{
        //    DateTime tempDt = DateTime.Now;          //保存按键按下时刻的时间点
        //    TimeSpan ts = tempDt .Subtract(_dt);     //获取时间间隔
        //    if (ts.Milliseconds > 50)                           //判断时间间隔,如果时间间隔大于50毫秒,则将TextBox清空
        //        textBox1.Text = "";
        //    dt = tempDt ;
        //}

        private void BarCode_BarCodeEvent(BardCodeHooK.BarCodes barCode)
        {
            //ShowInfo(barCode);
        }