public SearchBarcodeScan(SearchBarcodeForm appForm)
        {
            InitializeComponent();
            this.m_appForm = appForm;

            try
            {
                // Let's use the first available scanner.
                scanner = new Barcode2();
            }
            catch (Exception ex)
            {
                MessageBox.Show("Barcode2 instantiation failed with " + ex.Message);
                this.Close();
                return;
            }

            // Let's use triggers to fire up the scanner.
            scanner.Config.TriggerMode = TRIGGERMODES.HARD;

            // Register a scan event handler
            //scanner.OnScan += new Barcode2.OnScanHandler(barcode21_OnScan);
            scanner.OnScan += new Barcode2.OnScanHandler(barcode21_OnScan);
            scanner.OnStatus += new Barcode2.OnStatusHandler(barcode21_OnStatus);
        }
        public StartAudit_Form()
        {
            InitializeComponent();
            status = "Connect";

            m_AntennaInfoForm = new AntennaInfoForm(this);
            m_AntennaConfigForm = new AntennaConfigForm(this);
            m_PostFilterForm = new PostFilterForm(this);
            m_AccessFilterForm = new AccessFilterForm(this);
            m_TriggerForm = new TriggerForm(this);

            m_ReaderMgmt = new ReaderManagement();
            m_AccessOpResult = new AccessOperationResult();
            m_IsConnected = false;
            m_ReaderInitiatedDisconnectionReceived = false;
            sinfm = new ScanInventory_Form(this);
            searchcat = new SearchCategoryForm(this);
            searchBar = new SearchBarcodeForm(this);
        }
        private void btnsearch_Click(object sender, EventArgs e)
        {
            try
            {
                Cursor.Show();
                Cursor.Current = Cursors.WaitCursor;

                if (m_IsConnected)
                {
                    m_ReaderAPI.Disconnect();
                    m_IsConnected = false;

                    m_ReaderMgmt.Dispose();
                }

                    if (searchmenufrm == null)
                    {
                        searchmenufrm = new SearchmenuForm(this);
                    }

                    if (searchcat == null)
                    {
                        searchcat = new SearchCategoryForm(this);
                    }

                    if (searchBar == null)
                    {
                        searchBar = new SearchBarcodeForm(this);
                    }

                    //ms.Close();
                    Cursor.Current = Cursors.Default;
                    searchmenufrm.ShowDialog();
                    searchmenufrm.Dispose();
                    searchmenufrm = null;
                    GC.Collect();
                    return;

            }
            catch (Exception ex)
            {
                //MessageBox.Show("Try to connect service.", "Scan Inventory");
            }
            Cursor.Current = Cursors.Default;
        }