/// <summary> /// Determina el estado de la lectora y coloca un icono verde o rojo que muestra el estado detectado /// </summary> private void ConectarLectora() { try { //Get an array of connected readers int[] iReaders = Utility.GetConnectedReaders(); if (iReaders.Length > 0) { //Now we found reader so lets connect it. if (iReaders.Length > 1) { //We have multiple reader connected to system. //Handle this properly } else { //Create instance of the object mReader = new EReader(); //Open virtula serial port reader is connected to. mReader.Open(iReaders[0]); //Now add reader response event handler mReader.ReaderResponse += new dlReaderResponse(mReader_ReaderResponse); this.pictureLectora.Image = RFIDEnturnador.Properties.Resources.Ball_green_32; } } else { this.pictureLectora.Image = RFIDEnturnador.Properties.Resources.Ball_red_32; } } catch (Exception ex) { MessageBox.Show("Ocurrió un error al conectarse a la lectora, por favor intente de nuevo", "Error", MessageBoxButtons.OK, MessageBoxIcon.Error); string inner = ""; if (ex.InnerException != null) { inner = ex.InnerException.Message; } this.objUtil.LogError("Camiones", "LeerArchivo", ex.Message, inner, CGlobal.IdUsuario); } }
/// <summary> /// Determina el estado de la lectora y coloca un icono verde o rojo que muestra el estado detectado /// </summary> private void ConectarLectora() { try { //Get an array of connected readers int[] iReaders = Utility.GetConnectedReaders(); if (iReaders.Length > 0) { //Now we found reader so lets connect it. if (iReaders.Length > 1) { //We have multiple reader connected to system. //Handle this properly } else { //Create instance of the object mReader = new EReader(); //Open virtula serial port reader is connected to. mReader.Open(iReaders[0]); //Now add reader response event handler mReader.ReaderResponse += new dlReaderResponse(mReader_ReaderResponse); this.pictureLectora.Image = RFIDEnturnador.Properties.Resources.Ball_green_32; } } else { this.pictureLectora.Image = RFIDEnturnador.Properties.Resources.Ball_red_32; } } catch (Exception ex) { MessageBox.Show("Ocurrió un error al conectarse a la lectora, por favor intente de nuevo", "Error", MessageBoxButtons.OK, MessageBoxIcon.Error); string inner = ""; if (ex.InnerException != null) inner = ex.InnerException.Message; this.objUtil.LogError("Camiones", "LeerArchivo", ex.Message, inner, CGlobal.IdUsuario); } }