public TFMMainForm()
        {
            InitializeComponent();
            Aircraft.InitOffsets();
            // upgrade settings
            Properties.Settings.Default.Upgrade();
            synth.Rate = Properties.Settings.Default.SAPISpeechRate;
            // speak a debug message via SAPI if debug mode is turned on
            if (utility.DebugEnabled)
            {
                Tolk.PreferSAPI(true);
                Tolk.Output("Debug mode");
                Tolk.PreferSAPI(false);
            }

            if (Properties.Settings.Default.GeonamesUsername == "")
            {
                MessageBox.Show("Geonames username has not been configured. Flight following features will not function.\nGo to the General section in settings to add your Geonames user name\n", "error", MessageBoxButtons.OK, MessageBoxIcon.Exclamation);
            }


            inst.ScreenReaderOutput += onScreenReaderOutput;
            // Start the connection timer to look for a flight sim
            this.timerConnection.Start();
        }
        } // SetCommandKeyMenuText.

        private void Restart()
        {
            Tolk.PreferSAPI(true);
            Tolk.Output("TFM is restarting...");
            Tolk.PreferSAPI(false);
            Thread.Sleep(1500);
            Application.Restart();
        }             // Restart.
        public TFMMainForm()
        {
            InitializeComponent();
            // Upgrade settings from previous version.
            if (Properties.Settings.Default.SettingsRequiresUpgrade)
            {
                Properties.Settings.Default.Upgrade();
                Properties.Settings.Default.SettingsRequiresUpgrade = false;
                Properties.Settings.Default.Save();
                Application.Restart();
            }
            this.trayIcon.Visible = true;
            Aircraft.InitOffsets();

            // speak a debug message via SAPI if debug mode is turned on
            if (utility.DebugEnabled)
            {
                Tolk.PreferSAPI(true);
                Tolk.Output("Debug mode");
                Tolk.PreferSAPI(false);
            }

            if (Properties.Settings.Default.GeonamesUsername == "")
            {
                MessageBox.Show("Geonames username has not been configured. Flight following features will not function.\nGo to the General section in settings to add your Geonames user name\n", "error", MessageBoxButtons.OK, MessageBoxIcon.Exclamation);
            }


            // Start the connection timer to look for a flight sim
            TimerConnection.Elapsed       += TimerConnection_Tick;
            this.TimerConnection.AutoReset = true;
            this.TimerConnection.Start();

            if (Properties.Settings.Default.PlayStartupSound)
            {
                var         executable = Assembly.GetExecutingAssembly().Location;
                var         soundFile  = Path.Combine(Path.GetDirectoryName(executable), @"sounds\TFM-Startup.wav");
                SoundPlayer sound      = new SoundPlayer(soundFile);
                sound.Play();
            }

            utility.TFMMainForm = this;
        }
        // Form is closing so stop all the timers and close FSUIPC Connection
        private void frmMain_FormClosing(object sender, FormClosingEventArgs e)
        {
            /// TODO: Add message box confirmation for system tray shutdown code.

            Tolk.PreferSAPI(true);
            Tolk.Output("TFM is shutting down.");
            Tolk.PreferSAPI(false);
            Thread.Sleep(2000);

            if (Properties.Settings.Default.PlayShutdownSound)
            {
                var         executable = Assembly.GetExecutingAssembly().Location;
                var         soundFile  = Path.Combine(Path.GetDirectoryName(executable), @"sounds\TFM-Shutdown.wav");
                SoundPlayer sound      = new SoundPlayer(soundFile);
                sound.Play();
                Thread.Sleep(10000);
            }

            this.TimerConnection.Stop();
            this.TimerMain.Stop();
            this.TimerLowPriority.Stop();
            FSUIPCConnection.Close();
        }
        }     // ShowKeyboardManager.

        private bool ToggleCommandKeys()
        {
            bool isEnabled = false;

            if (inst.CommandKeyEnabled)
            {
                inst.CommandKeyEnabled = false;
                isEnabled = false;
                inst.ResetHotkeys();
                Tolk.PreferSAPI(true);
                Tolk.Output("command key disabled");
                Tolk.PreferSAPI(false);
            }
            else
            {
                inst.CommandKeyEnabled = true;
                isEnabled = true;
                inst.ResetHotkeys();
                Tolk.PreferSAPI(true);
                Tolk.Output("command key enabled");
                Tolk.PreferSAPI(false);
            }
            return(isEnabled);
        }     // ToggleCommandKeys.