using Admin.Core.Common; using log4net; namespace Aucma.Core.Scanner { /// /// 扫码器初始化 /// public class ScannerService : IScannerService { private static readonly log4net.ILog log = LogManager.GetLogger(typeof(ScannerService)); public delegate Task Instore(string materialBarCode); public static event Instore InstoreEvent; public async Task StartScannerAsync() { try { Task.Run(() => { Thread.Sleep(5000); InstoreEvent?.Invoke("B23600083025024860011"); }); MvCodeHelper.DeviceListAcq();//获取创建设备 MvCodeHelper.StartGrab(); // 开启触发扫码接收数据 } catch (Exception ex) { log.Error(ex.Message); MvCodeHelper.CloseAllDevice(); await StartScannerAsync(); } } } }