private void 自动测试ToolStripMenuItem_Click(object sender, EventArgs e) { tb_MacToBeSet.ReadOnly = true; tb_MacToBeSet.Focus(); btn_getAll.Enabled = false; btn_cleardev.Enabled = false; btn_SetMac.Enabled = false; setmac_finished = 0; reset_finished = 0; test_model = 1; lab_testmodel.Text = "自动测试"; BarCode = new BarCodeHook(); BarCode.BarCodeEvent += new BarCodeHook.BarCodeDelegate(BarCode_BarCodeEvent); BarCode.Start(); }
void BarCode_BarCodeEvent(BarCodeHook.BarCodes barCode) { ShowInfo(barCode); }
private void ShowInfo(BarCodeHook.BarCodes barCode) { if (this.InvokeRequired) { this.BeginInvoke(new ShowInfoDelegate(ShowInfo), new object[] { barCode }); } else { string pre_barcode = barCode.IsValid ? barCode.BarCode : ""; tb_MacToBeSet.Text = Regex.Replace(pre_barcode, @"\s", ""); } }