private void Page_Loaded(object sender, RoutedEventArgs e) { // 页面加载完成,需要开启Timer等待二维码动作 // 直接跳转到产品列表 if (Api.openDevice()) { Api.backlight(lightOn); Api.controlScan(true); dtimer.Start(); } else { labelTip.Content = "连接设备失败"; } }
public ScannerReturn Open() { //Open device if (Api.openDevice(1)) { //Add QRCODE support, QRCODE format id = 1 if (Api.addCodeFormat((byte)1)) { Api.backlight(true); return(ScannerReturn.SUCCESS); } else { //if cant add QRCODE, disconnet device and return false Api.backlight(false); Api.disConnected(); return(ScannerReturn.ADD_FORMAT_FAIL); } } else { return(ScannerReturn.OPEN_FAIL); } }
public MainViewModel(CardInfoService cardInfoService, Vbarapi vbarapi, Reader rfidReader, CardInfoViewModel cardInfo, SearchInfoViewModel searchInfo) { _cardInfoService = cardInfoService; _vbarapi = vbarapi; _vbarapi.openDevice(1); _vbarapi.addCodeFormat((byte)1); _vbarapi.backlight(false); _rfidReader = rfidReader; CardInfo = cardInfo; SearchInfo = searchInfo; if (IsInDesignMode) { //LoadData(""); } else { Message = string.Format("服务器基础地址:{0}", Properties.Settings.Default.ApiBaseUrl); } }