public Grammar ToGrammar(string channelName, VoiceCmdSetting.VoiceGrammar voiceGrammar)
        {
            GrammarBuilder gb = new GrammarBuilder();

            // prepare grammar
            if (voiceGrammar.startWord != null)
            {
                gb.Append(voiceGrammar.startWord);
            }
            gb.Append(new Choices(voiceGrammar.patterns));

            // grammar name is channelName.grammar_type
            Grammar g = new Grammar(gb);

            g.Name = channelName + "." + voiceGrammar.type;

            gb = null;

            return(g);
        }
        public void UpdateGrammar(string channelName, VoiceCmdSetting.VoiceGrammar voiceGrammar)
        {
            Grammar grammarToUpdate = ToGrammar(channelName, voiceGrammar);

            s_recognizer.RequestRecognizerUpdate(new GrammarUpdateObject(grammarToUpdate, voiceGrammar.confidence));
        }