日期:2014-05-18  浏览次数:20696 次

大家帮忙解决个PDA程序开发上的一个问题
在PDA上写了个条码扫描功能,PDA系统是WinCE出了点问题大家帮忙看看:
C# code

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

using MEC.Nurse.Provider;

namespace RFIDDemo
{
    /// <summary>
    /// Form1 的摘要说明。
    /// </summary>
    public class Form1 : System.Windows.Forms.Form
    {
        private System.Windows.Forms.Button btnStart;
        private System.Windows.Forms.Button btnStop;
        private System.Windows.Forms.TextBox txtData;
        private System.Windows.Forms.Button btnClearText;
        private System.Windows.Forms.Button btnStartRead;
        private System.Windows.Forms.Button btnReadStop;
        private System.Windows.Forms.Label lblInfo;

        public Form1()
        {
            //
            // Windows 窗体设计器支持所必需的
            //
            InitializeComponent();

            //
            // TODO: 在 InitializeComponent 调用后添加任何构造函数代码
            //

            // 绑定函数到OnDataAttrived事件上
            // 在读取到RFID数据后会回调绑定到该事件上的函数
            RFID.GetInstance().OnDataArrived += new RFIDEventHandler(OnDataArrived);

            // 获取rfid服务的状态
            if (RFID.GetInstance().GetServerState())
            {
                
                StartEnable();
                lblInfo.Text = "RFID服务已启动!";
            }
            else
            {
                if(RFID.GetInstance().Start())
                {
                    StartEnable();
                    lblInfo.Text = "RFID服务启动成功!";
                    MessageBox.Show("aaaa");
                }
                else
                {
                    StopEnable();
                    lblInfo.Text = "RFID服务启动失败!";
                }
            }
        }
        /// <summary>
        /// 清理所有正在使用的资源。
        /// </summary>
        protected override void Dispose( bool disposing )
        {
            base.Dispose( disposing );
        }
        #region Windows 窗体设计器生成的代码
        /// <summary>
        /// 设计器支持所需的方法 - 不要使用代码编辑器修改
        /// 此方法的内容。
        /// </summary>
        private void InitializeComponent()
        {
            this.btnStart = new System.Windows.Forms.Button();
            this.btnStop = new System.Windows.Forms.Button();
            this.txtData = new System.Windows.Forms.TextBox();
            this.btnClearText = new System.Windows.Forms.Button();
            this.lblInfo = new System.Windows.Forms.Label();
            this.btnReadStop = new System.Windows.Forms.Button();
            this.btnStartRead = new System.Windows.Forms.Button();
            // 
            // btnStart
            // 
            this.btnStart.Location = new System.Drawing.Point(16, 8);
            this.btnStart.Size = new System.Drawing.Size(88, 24);
            this.btnStart.Text = "启动";
            this.btnStart.Click += new System.EventHandler(this.btnStart_Click);
            // 
            // btnStop
            // 
            this.btnStop.Location = new System.Drawing.Point(120, 8);
            this.btnStop.Size = new System.Drawing.Size(88, 24);
            this.btnStop.Text = "停止 ";
            this.btnStop.Click += new System.EventHandler(this.btnStop_Click);
            // 
            // txtData
            // 
            this.txtData.Location = new System.Drawing.Point(16, 72);
            this.txtData.Multiline = true;
            this.txtData.Size = new System.Drawing.Size(192, 152);
            this.txtData.Text = "";
            // 
            // btnClearText
            // 
            this.btnClearText.Location = new System.Drawing.Point(16, 232);
            this.btnClearText.Size = new System.Drawing.Size(72, 32);
            this.btnClearText.Text = "清空";
            this.btnClearText.Click