當前位置: 首頁>>代碼示例>>C#>>正文


C# Choices.Append方法代碼示例

本文整理匯總了C#中Choices.Append方法的典型用法代碼示例。如果您正苦於以下問題:C# Choices.Append方法的具體用法?C# Choices.Append怎麽用?C# Choices.Append使用的例子?那麽, 這裏精選的方法代碼示例或許可以為您提供幫助。您也可以進一步了解該方法所在Choices的用法示例。


在下文中一共展示了Choices.Append方法的2個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的C#代碼示例。

示例1: getGrammar

 public Grammar getGrammar()
 {
     Choices setChoices = new Choices("I'd like to set an alarm for", "Set alarm for", "Set Alarm Clock", "Set Alarm");
     GrammarBuilder morningChoices = new Choices("am", "in the morning");
     morningChoices.Append(new SemanticResultValue(true));
     GrammarBuilder eveningChoices = new Choices("pm", "tonight", "at night");
     eveningChoices.Append(new SemanticResultValue(false));
     Choices amOrPm = new Choices(morningChoices, eveningChoices);
     SemanticResultKey amOrPmKey = new SemanticResultKey("AmPm", amOrPm);
     Choices hours = new Choices("1", "2", "3", "4", "5", "6", "7", "8", "9", "10", "11", "12");
     Choices minutes = new Choices("10", "15", "20", "25", "30", "35", "40", "45", "50", "55", "60", "o'clock", " ");
     GrammarBuilder thisGB = new GrammarBuilder();
     thisGB.Append(setChoices);
     thisGB.Append(new SemanticResultKey("Hours", hours));
     thisGB.Append(new SemanticResultKey("Minutes", minutes));
     thisGB.Append(amOrPmKey);
     Grammar thisGrammar = new Grammar(thisGB);
     // Set the Grammar name
     thisGrammar.Name = _grammarName;
     return thisGrammar;
 }
開發者ID:EquinoxSoftware,項目名稱:Alfred,代碼行數:21,代碼來源:AlarmClock.cs

示例2: InitGrammar

        private void InitGrammar()
        {
            GrammarBuilder readGrammar = new Choices(new string[] { "read article" });
            Choices articleChoice = new Choices();
            for (int i = 1; i <= 30; i++)
            {
                articleChoice.Add(i.ToString());
            }
            readGrammar.Append(articleChoice);

            GrammarBuilder saveGrammar = new Choices(new string[] { "save article" });
            saveGrammar.Append(articleChoice);

            GrammarBuilder otherGrammar = new Choices(new string[] { "receive hacker news", "stop", "test" });

            //GrammarBuilder commands = new Choices(new string[] { "receive hacker news", "stop", "test" });
            Choices commands = new Choices();
            commands.Add(new Choices(new GrammarBuilder[] { readGrammar, saveGrammar, otherGrammar }));

            var grammar = new Grammar(commands);
            this._speechRecognizer.LoadGrammar(grammar);
        }
開發者ID:srw,項目名稱:hacker-news-voice-browsing-dotnet-sample,代碼行數:22,代碼來源:MainForm.cs


注:本文中的Choices.Append方法示例由純淨天空整理自Github/MSDocs等開源代碼及文檔管理平台,相關代碼片段篩選自各路編程大神貢獻的開源項目,源碼版權歸原作者所有,傳播和使用請參考對應項目的License;未經允許,請勿轉載。