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); } }
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); } }