public void DetachStatusNotify(Barcode2.OnStatusHandler statusNotifyHandler) { if (_myBarcode2 == null) { return; } _myBarcode2.OnStatus -= statusNotifyHandler; }
/// <summary> /// Detach a StatusNotify handler. /// </summary> public void DetachStatusNotify(Barcode2.OnStatusHandler StatusNotifyHandler) { // If we have a reader registered for receiving the status notifications if (myBarcode2 != null) { // Detach the status notification handler. myBarcode2.OnStatus -= StatusNotifyHandler; } }
/// <summary> /// Attach a StatusNotify handler. /// </summary> public void AttachStatusNotify(Barcode2.OnStatusHandler StatusNotifyHandler) { // If we have a reader if (myBarcode2 != null) { // Attach status notification handler. myBarcode2.OnStatus += StatusNotifyHandler; } }
private void SelectLocation_Form_Load(object sender, EventArgs e) { Cursor.Show(); Cursor.Current = Cursors.WaitCursor; try { // Initialize the ScanAPI reference. this.myScanAPI = new API(); this.isBarcodeInitiated = this.myScanAPI.InitBarcode(); if (!(this.isBarcodeInitiated))// If the Barcode object has not been initialized { // Display a message & exit the application. MessageBox.Show("Barcode not been initialized"); Application.Exit(); } else // If the Barcode object has been initialized { // Attach a scan notification handler. this.myScanNotifyHandler = new Barcode2.OnScanHandler(barcode21_OnScan); myScanAPI.AttachScanNotify(myScanNotifyHandler); // Attach a status notification handler. this.myStatusNotifyHandler = new Barcode2.OnStatusHandler(barcode21_OnStatus); myScanAPI.AttachStatusNotify(myStatusNotifyHandler); } myFormActivatedEventHandler = new EventHandler(MainForm_Activated); myFormDeactivatedEventHandler = new EventHandler(MainForm_Deactivate); this.Activated += myFormActivatedEventHandler; this.Deactivate += myFormDeactivatedEventHandler; locTagID_TextBox.Text = GlobalVariables.Temp_LocationName; } catch (Exception ex) { MessageBox.Show(ex.Message, "Scan Inventory"); } Cursor.Current = Cursors.Default; }