private void continuousInputButton_Click(object sender, global::System.EventArgs e)
        {
            continuousInputButton.Enabled = false;
            grammarPhraseTextBox.Enabled  = false;
            grammarPhraseListBox.Enabled  = false;
            addToGrammarButton.Enabled    = false;
            speechRecognitionEngine       = new global::System.Speech.Recognition.SpeechRecognitionEngine();
            LoadGrammar();
            recordingDeviceComboBox.Enabled = false;
            recordingDeviceID = recordingDeviceComboBox.SelectedIndex; // 20171214
            int detectionThreshold = int.Parse(detectionThresholdTextBox.Text);

            continuousSpeechRecognitionControl.DetectionThreshold = detectionThreshold;
            continuousSpeechRecognitionControl.RecordingDeviceID  = recordingDeviceID;
            continuousSpeechRecognitionControl.SetSpeechRecognitionEngine(speechRecognitionEngine);
            continuousSpeechRecognitionControl.ShowSoundStream       = showSoundStreamToolStripMenuItem.Checked;
            continuousSpeechRecognitionControl.ExtractDetectedSounds = extractDetectedSoundsToolStripMenuItem.Checked;
            continuousSpeechRecognitionControl.Start();
            continuousInputStopButton.Enabled = true;
        }
        private void HandleConnectionEstablished(object sender, global::System.EventArgs e)
        {
            // Start continuous recognition once a connection to the server has been established
            grammarPhraseTextBox.Enabled = false;
            grammarPhraseListBox.Enabled = false;
            addToGrammarButton.Enabled   = false;
            speechRecognitionEngine      = new global::System.Speech.Recognition.SpeechRecognitionEngine();
            LoadGrammar();
            recordingDeviceComboBox.Enabled = false;
            int detectionThreshold = int.Parse(detectionThresholdTextBox.Text);

            continuousSpeechRecognitionControl.DetectionThreshold = detectionThreshold;
            continuousSpeechRecognitionControl.RecordingDeviceID  = recordingDeviceID;
            continuousSpeechRecognitionControl.SetSpeechRecognitionEngine(speechRecognitionEngine);
            continuousSpeechRecognitionControl.ShowSoundStream       = showSoundStreamToolStripMenuItem.Checked;
            continuousSpeechRecognitionControl.ExtractDetectedSounds = extractDetectedSoundsToolStripMenuItem.Checked;
            continuousSpeechRecognitionControl.Start();
            continuousInputButton.Enabled     = false;
            continuousInputStopButton.Enabled = true;
        }
 private void SetUpSpeechRecognizer()
 {
     speechRecognitionEngine = new global::System.Speech.Recognition.SpeechRecognitionEngine();
     LoadGrammar();
 }