/// <summary> /// Stop reading and disable/close reader /// </summary> private void TermReader() { // If we have a reader if (this.MyReader != null) { //Disable the reader this.MyReader.Actions.Disable(); //Free it up this.MyReader.Dispose(); //Indicate we no longer have one this.MyReader = null; } // If we have a reader data if (this.MyReaderData != null) { //Free it up this.MyReaderData.Dispose(); //Indicate we no longer have one this.MyReaderData = null; } }
public override bool init() { try { //If reader is already present then fail initalize if (this.MyReader != null) { return(false); } //Create new reader, first available reader will be used. this.MyReader = new PT.Barcode.Reader(); //Create reader data this.MyReaderData = new PT.Barcode.ReaderData( PT.Barcode.ReaderDataTypes.Text, PT.Barcode.ReaderDataLengths.MaximumLabel); //Create event handler delegate this.MyEventHandler = new EventHandler(MyReader_ReadNotify); //Enable reader this.MyReader.Actions.Enable(); this.MyReader.Actions.ToggleSoftTrigger(); StartRead(); //Success Init Complete // return true; } catch (Exception ex) { MessageBox.Show(ex.ToString()); return(false); } return(true); }