/// <summary> /// 附加扫描结果通知事件回调函数 /// </summary> /// <param name="ScanNotifyHandler"></param> public void AttachScanNotify(Barcode2.OnScanHandler ScanNotifyHandler) { if (barcode2 != null) { barcode2.OnScan += ScanNotifyHandler; } }
private void Form1_Load(object sender, EventArgs e) { // Add MainMenu if Pocket PC if (Symbol.Win32.PlatformType.IndexOf("PocketPC") != -1) { this.Menu = this.mainMenu1; } try { _isBarcodeInitiated = _myScanApi.InitBarcode(); if (!(_isBarcodeInitiated)) { Application.Exit(); } else { _myScanNotifyHandler = myScanAPI_ScanNotify; _myScanApi.AttachScanNotify(_myScanNotifyHandler); _myScanApi.StartScan(false); } } catch (Exception ex) { MessageBox.Show(ex.Message); } Bitmap MyImage; pictureBox1.SizeMode = PictureBoxSizeMode.StretchImage; MyImage = new Bitmap("\\Release\\OK.png"); pictureBox1.Image = (Image)MyImage; }
/// <summary> /// Detach the ScanNotify handler. /// </summary> public void DetachScanNotify(Barcode2.OnScanHandler ScanNotifyHandler) { if (myBarcode2 != null) { // Detach the read notification handler. myBarcode2.OnScan -= ScanNotifyHandler; } }
public void DetachScanNotify(Barcode2.OnScanHandler scanNotifyHandler) { if (_myBarcode2 == null) { return; } _myBarcode2.OnScan -= scanNotifyHandler; }
/// <summary> /// Attach a ScanNotify handler. /// </summary> public void AttachScanNotify(Barcode2.OnScanHandler ScanNotifyHandler) { // If we have a reader if (myBarcode2 != null) { // Attach the read notification handler. myBarcode2.OnScan += ScanNotifyHandler; } }
private void ScanItem_Load(object sender, EventArgs e) { try { objHelper = new Helper(); lbCust.Text += CustName; lbLocation.Text += LocationName; lbActivity.Text += ItemActivity; lbQty.Visible = false; txtQty.Visible = false; txtQty.Text = String.Empty; btnSave.Visible = false; btnCancel.Visible = false; //Demo //lbScanItem.Text = "ATO2202044-0055-4-000/NC1250"; //lbQtyNum.Visible = true; //lbQtyNum.Text = "Qty: " + "1"; //string ItemBarCode = string.Empty; //string ItemNum = string.Empty; //string BatchNum = string.Empty; //string strMasterAction = string.Empty; //string strNewItemID = string.Empty; //if (lbScanItem.Text.Substring(0, 3) == "ATO") // ItemBarCode = lbScanItem.Text.Substring(3); //else // ItemBarCode = lbScanItem.Text; //ItemNum = ItemBarCode.Substring(0, ItemBarCode.IndexOf("/")); //BatchNum = ItemBarCode.Substring(ItemBarCode.IndexOf("/") + 1); //strMasterAction = objHelper.checkScanItem(ItemNum, BatchNum, ItemActivityID); //if (strMasterAction == "E") //{ // MessageBox.Show("Invalid Item."); //} //else //{ // strNewItemID = objHelper.insertScanItem(ItemNum, BatchNum, CustName, LocationName, ItemActivityID, 1, strScannerID, UserID, strMasterAction); // strCurrentItem = strNewItemID; //} conn = new SqlCeConnection(Helper.strConn); conn.Open(); MyReader = new Barcode2(); eventHandler = new Barcode2.OnScanHandler(MyReader_OnScan); MyReader.OnScan += eventHandler; MyReader.ScanBufferStart(); } catch (Exception ex) { Helper.LogError(ex, "ScanItem_Load"); } }
private void MainForm_Load(object sender, System.EventArgs e) { //this.myActivateHandler = new System.EventHandler(this.listViewMain_ItemActivate); // this.listViewMain.ItemActivate += this.myActivateHandler; // Add MainMenu if Pocket PC if (Symbol.Win32.PlatformType.IndexOf("PocketPC") != -1) { this.Menu = new MainMenu(); } // Initialize the ScanSampleAPI reference. this.myScanSampleAPI = new API(); this.isBarcodeInitiated = this.myScanSampleAPI.InitBarcode(); if (!(this.isBarcodeInitiated))// If the Barcode object has not been initialized { // Display a message & exit the application. MessageBox.Show(Resources.GetString("AppExitMsg")); Application.Exit(); } else // If the Barcode object has been initialized { // Clear the statusbar where subsequent status information would be displayed. //statusBar.Text = ""; // Attach a scan notification handler. this.myScanNotifyHandler = new Barcode2.OnScanHandler(myBarcode2_ScanNotify); myScanSampleAPI.AttachScanNotify(myScanNotifyHandler); // Attach a status notification handler. //this.myStatusNotifyHandler = new Barcode2.OnStatusHandler(myBarcode2_StatusNotify); //myScanSampleAPI.AttachStatusNotify(myStatusNotifyHandler); } // Ensure that the keyboard focus is set on a control. myFormActivatedEventHandler = new EventHandler(MainForm_Activated); myFormDeactivatedEventHandler = new EventHandler(MainForm_Deactivate); this.Activated += myFormActivatedEventHandler; this.Deactivate += myFormDeactivatedEventHandler; FullScreen.StartFullScreen(this); }
private void Location_Load(object sender, EventArgs e) { try { lbUser.Text += UserName; lbCustName.Text += CustName; lbLocationName.Text += LocationName; lbActivity.Text += ItemActivity; MyReader = new Barcode2(); eventHandler = new Barcode2.OnScanHandler(MyReader_OnScan); MyReader.OnScan += eventHandler; MyReader.ScanBufferStart(); } catch (Exception ex) { MessageBox.Show("Location_Load: " + ex.Message); } }
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; }
public void AttachScanNotify(Barcode2.OnScanHandler ScanNotifyHandler) { }