public void TestMethod5() { ScanService service = new ScanService(); string err; bool result = service.Init(out err); if (!result) { Debug.WriteLine(err); Assert.Fail("初始化失败"); } Action <string, string> action = (l, k) => { Debug.WriteLine(l); Debug.WriteLine(k); }; service.StartEngine(action); while (true) { Debug.WriteLine("running..."); Thread.Sleep(3000); } }
/// <summary> 执行刷卡引擎 </summary> public void StartScanEngine(Action <string, string> action) { if (this.IsWin7()) { ScanningPrivder.Instance.CallBackScanning += l => { action(l, "识别到条形码!" + l); }; ScanningPrivder.Instance.StartEngine(); } else { service.StartEngine(action); } }