private void EnableVoiceCommand()
        {
            try
            {
                if (IsVoiceCommandEnabled) return;

                // if call name isn't set, ask for one
                if (string.IsNullOrEmpty(Properties.Settings.Default.CallName.Trim()))
                {
                    var voiceForm = new VoiceForm();
                    if (voiceForm.ShowDialog() == DialogResult.OK)
                    {
                        if (voiceForm.GetName != Properties.Settings.Default.CallName)
                        {
                            Properties.Settings.Default.CallName = voiceForm.GetName;
                            Properties.Settings.Default.Save();

                            // if voice command is running, restart it
                            if (voice != null)
                            {
                                IsVoiceCommandEnabled = false;
                                voice.SpeechRecognizedEvent += voice_SpeechRecognizedEvent;
                                voice.AudioLevelUpdatedEvent += voice_AudioLevelUpdatedEvent;
                                voice.Dispose();
                                voice = null;
                            }
                            SetStatusMsg("Voice Command: Name changed to " + Properties.Settings.Default.CallName, true);
                        }
                    }
                    voiceForm.Dispose();
                }

                if (voice == null)
                {
                    voice = new VoiceCommandEngine(Properties.Settings.Default.CallName);
                    voice.SpeechRecognizedEvent += voice_SpeechRecognizedEvent;
                    voice.AudioLevelUpdatedEvent += voice_AudioLevelUpdatedEvent;
                }
                voice.StartListening();
                speechButton.Image = Properties.Resources.enabled_mic;
                IsVoiceCommandEnabled = true;
            }
            catch (Exception)
            {
                MessageBox.Show(
                    "There was a problem while starting voice command.\nPlease make sure your mic is plugged in.",
                    "Voice Command", MessageBoxButtons.OK, MessageBoxIcon.Asterisk);
                speechButton.Image = Properties.Resources.disabled_mic;

                if (voice != null)
                    voice.StopListening();
                IsVoiceCommandEnabled = false;
            }
        }
        private void voiceCommandHelpToolStripMenuItem_Click(object sender, EventArgs e)
        {
            var voiceForm = new VoiceForm();
            if (voiceForm.ShowDialog() == DialogResult.OK)
            {
                if (voiceForm.GetName != Properties.Settings.Default.CallName)
                {
                    Properties.Settings.Default.CallName = voiceForm.GetName;
                    Properties.Settings.Default.Save();

                    // if voice command is running, restart it
                    if (voice != null)
                    {
                        var voiceCommandState = IsVoiceCommandEnabled;

                        IsVoiceCommandEnabled = false;
                        voice.SpeechRecognizedEvent += voice_SpeechRecognizedEvent;
                        voice.AudioLevelUpdatedEvent += voice_AudioLevelUpdatedEvent;
                        voice.Dispose();
                        voice = null;

                        // if voice command was enabled, re-enable it
                        if (voiceCommandState)
                            EnableVoiceCommand();
                    }
                    SetStatusMsg("Voice Command: Name changed to " + Properties.Settings.Default.CallName, true);
                }
            }
            voiceForm.Dispose();
        }