void xEng_DecodeEvent(object sender, DecodeBase.DecodeEventArgs e) { BCId nCodeID = BCId.NoData; string sBarCode = string.Empty; BarcodeScannerEventArgs ba; // Obtain the string and code id. try { if ((e.DecodeResults.nLength > 0) && (e.DecodeResults.rResult == Result.RESULT_SUCCESS)) { //switch (e.DecodeResults.chCodeID) //{ // case "d": // case "D": // nCodeID = BCId.EAN13; // break; // case "e": // nCodeID = BCId.Interleaved25; // break; // case "I": // case "j": // nCodeID = BCId.Code128; // break; // case "w": // nCodeID = BCId.DataMatrix; // break; // default: // break; //} nCodeID = SetBarcodeType(e.DecodeResults.chCodeID); sBarCode = e.DecodeResults.pchMessage; } } catch (Exception) { //MessageBox.Show("Error reading string!"); } ba = new BarcodeScannerEventArgs(nCodeID, e.DecodeResults.pchMessage, e.DecodeResults.binaryData, e.DecodeResults.nLength); OnBarcodeScan(ba); return; }
void xEng_DecodeEvent(object sender, DecodeBase.DecodeEventArgs e) { BCId nCodeID = BCId.NoData; string sBarCode = string.Empty; BarcodeScannerEventArgs ba; try { //RightLEDOff(); //--- Was the Decode Attempt Successful? --- if (e.DecodeResults.rResult == Result.RESULT_SUCCESS) { //xEng.Device.SetLEDs(Device.LedSelect.RightGreen, Device.LedState.On, 0, 0); //sBarCode = e.DecodeResults.chCodeID; //switch (sBarCode) //{ // case "d": // case "D": // nCodeID = BCId.EAN13; // break; // case "j": // nCodeID = BCId.Code128; // break; // case "w": // nCodeID = BCId.DataMatrix; // break; // default: // break; //} nCodeID = base.SetBarcodeType(e.DecodeResults.chCodeID); sBarCode = e.DecodeResults.pchMessage; //--- Play an SDK Provided Audible Sound --- //xEng.so..Sound.Play(Sound.SoundTypes.Success); ba = new BarcodeScannerEventArgs(nCodeID, sBarCode, e.DecodeResults.binaryData, e.DecodeResults.binaryData.Length); OnBarcodeScan(ba); } else { //--- Async Decode Exception --- switch (e.DecodeResults.rResult) { case Result.RESULT_ERR_CANCEL: // Async Decode was Canceled return; case Result.RESULT_ERR_NODECODE: // Scan Timeout //MessageBox.Show("Scan Timeout Exceeded"); break; default: //MessageBox.Show(e.DecodeException.Message); break; } //if (e.DecodeResults.rResult..DecodeException != null) //{ //} //else //{ // //--- Generic Async Exception --- // //MessageBox.Show(e.Exception.Message); //} //xEng.Sound.Play(Sound.SoundTypes.Failure); } } catch (Exception ex) { //MessageBox.Show(ex.Message); } return; }