/// <summary> /// Stop reading and disable/close the reader. /// </summary> public void TermReader() { // If we have a reader if (mReader != null) { try { // stop all the notifications. StopRead(); //Detach all the notification handler if the user has not done it already. DetachReadNotify(); DetachStatusNotify(); // Disable the reader. mReader.Actions.Disable(); // Free it up. mReader.Dispose(); // Make the reference null. mReader = null; } catch (Exception ex) { MessageBox.Show(ex.Message); } } // After disposing the reader, dispose the reader data. if (mReaderData != null) { try { // Free it up. mReaderData.Dispose(); // Make the reference null. mReaderData = null; } catch (Exception ex) { MessageBox.Show(ex.Message); } } }
/// <summary> /// Stop reading and disable/close the reader. /// </summary> public void TermReader() { // If we have a reader if (myReader != null) { try { // stop all the notifications. StopRead(); //Detach all the notification handler if the user has not done it already. DetachReadNotify(); DetachStatusNotify(); // Disable the reader. myReader.Actions.Disable(); // Free it up. myReader.Dispose(); // Make the reference null. myReader = null; } catch (Symbol.Exceptions.OperationFailureException ex) { MessageBox.Show("TermReader" + "\n" + "OperationFailure" + "\n" + ex.Message + "\n" + "Result" + " = " + (Symbol.Results)((uint)ex.Result) ); } catch (Symbol.Exceptions.InvalidRequestException ex) { MessageBox.Show("TermReader" + "\n" + "InvalidRequest" + "\n" + ex.Message); } catch (Symbol.Exceptions.InvalidIndexerException ex) { MessageBox.Show("TermReader" + "\n" + "InvalidIndexer" + "\n" + ex.Message); }; } // After disposing the reader, dispose the reader data. if (myReaderData != null) { try { // Free it up. myReaderData.Dispose(); // Make the reference null. myReaderData = null; } catch (Symbol.Exceptions.OperationFailureException ex) { MessageBox.Show("TermReader" + "\n" + "OperationFailure" + "\n" + ex.Message + "\n" + "Result" + " = " + (Symbol.Results)((uint)ex.Result) ); } catch (Symbol.Exceptions.InvalidRequestException ex) { MessageBox.Show("TermReader" + "\n" + "InvalidRequest" + "\n" + ex.Message); } catch (Symbol.Exceptions.InvalidIndexerException ex) { MessageBox.Show("TermReader" + "\n" + "InvalidIndexer" + "\n" + ex.Message); }; } }