Example #1
0
 private void menuItemClose_Click(object sender, EventArgs e)
 {
     MyAudioController.Dispose();
     MyRFGun.Close();
     this.Close();
 }
Example #2
0
        /// <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;

                    myAudioController.Dispose();
                    myAudioController = null;
                }

                catch (Symbol.Exceptions.OperationFailureException ex)
                {
                    MessageBox.Show(Resources.GetString("TermReader") + "\n" +
                                    Resources.GetString("OperationFailure") + "\n" + ex.Message +
                                    "\n" +
                                    Resources.GetString("Result") + " = " + (Symbol.Results)((uint)ex.Result)
                                    );
                }
                catch (Symbol.Exceptions.InvalidRequestException ex)
                {
                    MessageBox.Show(Resources.GetString("TermReader") + "\n" +
                                    Resources.GetString("InvalidRequest") + "\n" +
                                    ex.Message);
                }
                catch (Symbol.Exceptions.InvalidIndexerException ex)
                {
                    MessageBox.Show(Resources.GetString("TermReader") + "\n" +
                                    Resources.GetString("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(Resources.GetString("TermReader") + "\n" +
                                    Resources.GetString("OperationFailure") + "\n" + ex.Message +
                                    "\n" +
                                    Resources.GetString("Result") + " = " + (Symbol.Results)((uint)ex.Result)
                                    );
                }
                catch (Symbol.Exceptions.InvalidRequestException ex)
                {
                    MessageBox.Show(Resources.GetString("TermReader") + "\n" +
                                    Resources.GetString("InvalidRequest") + "\n" +
                                    ex.Message);
                }
                catch (Symbol.Exceptions.InvalidIndexerException ex)
                {
                    MessageBox.Show(Resources.GetString("TermReader") + "\n" +
                                    Resources.GetString("InvalidIndexer") + "\n" +
                                    ex.Message);
                };
            }
        }