【问题标题】:CK30: After using BarcodeReader() my keyboard stops workingCK30:使用 BarcodeReader() 后,我的键盘停止工作
【发布时间】:2013-01-17 12:08:09
【问题描述】:

我正在为带有 2D 阅读器的 Intermec 手持设备 CK30 开发 C# compact framework 2.0(windows mobile 6.1)。

每次我使用条形码时,我的键盘都会停止工作。任何想法为什么?

这是代码。第一部分是配置条形码阅读器的类。第二部分是使用条形码阅读器填充文本框的表单。

使用条形码阅读器读取内容后,键盘停止工作......

using System;
using System.Collections.Generic;
using System.Text;
using System.Windows.Forms;

using Intermec.DataCollection;

namespace BarCodeReaderTest
{
    class LeitorCodigoDeBarras
    {
        public BarcodeReader LerCodigoDeBarras()
        {
            try
            {
                BarcodeReader meuLeitor = new BarcodeReader("default", 4096);
                meuLeitor.ScannerEnable = true;
                meuLeitor.ThreadedRead(true);

                return meuLeitor;
            }
            catch (BarcodeReaderException bx)
            {
                MessageBox.Show("Não foi possível inicializar o leitor de código de     barras. Contate seu supervisor. \n" + bx.Message);

                return null;
            }
        }
    }
}


using System;

using System.Collections.Generic;
using System.ComponentModel;
using System.Data;
using System.Drawing;
using System.Text;
using System.Windows.Forms;

using Intermec.DataCollection;

namespace BarCodeReaderTest
{
    public partial class Form1 : Form
    {



        public BarcodeReader leitor;

        public Form1()
        {

            InitializeComponent();

            LeitorCodigoDeBarras classeLeitor = new LeitorCodigoDeBarras();

            leitor = classeLeitor.LerCodigoDeBarras();
            leitor.BarcodeRead += new     BarcodeReadEventHandler(this.eventoLeitorCodigoDeBarras);

        }


        void eventoLeitorCodigoDeBarras(object sender, BarcodeReadEventArgs e)
        {
            tbCodLido.Text = e.strDataBuffer;
        }
    }        
}

【问题讨论】:

  • 我从来没有听说过这样的问题,这没有逻辑意义。这真的是您测试和重现问题的代码吗?
  • 是的,好心的先生。
  • 使用最新固件重新刷新设备或首先尝试恢复出厂默认设置。这不是正常行为。
  • 已经做到了。没有成功。我实际上正在使用 6 个相同型号的不同设备。

标签: c#-2.0 windows-mobile-6.1 intermec handhelddevice


【解决方案1】:

好的,我现在宣布您在一个单独的类中使用 BarcodeReader。

请尝试以下标准示例(一个列表框和一个按钮):

using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.Data;
using System.Drawing;
using System.Text;
using System.Windows.Forms;
using Intermec.DataCollection;
namespace BarcodeReader
{
    public partial class Form1 : Form
    {
        private Intermec.DataCollection.BarcodeReader bcr;
        public Form1()
        {
            InitializeComponent();
            bcr = new Intermec.DataCollection.BarcodeReader();
            bcr.BarcodeRead += new BarcodeReadEventHandler(bcr_BarcodeRead);
            bcr.ThreadedRead(true);
        }
        void bcr_BarcodeRead(object sender, BarcodeReadEventArgs bre)
        {
            this.listBox1.Items.Add(bre.strDataBuffer);
        }
    }
    private void btnExit_Click(object sender, EventArgs e)
    {
        if (bcr !=null)
        {
            bcr.Dispose();
        }
        Application.Exit();
    }
}

如果可行(另请参阅 Intermec Datacollection 资源工具包随附的示例),我们可以检查,为什么您的构造不起作用。我假设您安装了最新的 DataCollection Resource Kit。

【讨论】:

    猜你喜欢
    • 1970-01-01
    • 2016-12-07
    • 1970-01-01
    • 2010-09-15
    • 2011-11-10
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    相关资源
    最近更新 更多