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


C# Tropo.Ask方法代碼示例

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


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

示例1: testAsk

        public void testAsk()
        {
            Say say = new Say("Please enter your 5 digit zip code.");
            Choices choices = new Choices("[5 DIGITS]");

            Tropo tropo = new Tropo();
            tropo.Ask(null, null, choices, null, "foo", null, say, null);
            Assert.AreEqual(this.askJson, tropo.RenderJSON());
        }
開發者ID:nSource,項目名稱:tropo-webapi-csharp,代碼行數:9,代碼來源:TropoClassesTests.cs

示例2: testAskFromObject

        public void testAskFromObject()
        {
            Say say = new Say("Please enter your 5 digit zip code.");
            Choices choices = new Choices("[5 DIGITS]");
            Ask ask = new Ask(choices, "foo", say);

            Tropo tropo = new Tropo();
            tropo.Ask(ask);
            Assert.AreEqual(this.askJson, tropo.RenderJSON());
        }
開發者ID:nSource,項目名稱:tropo-webapi-csharp,代碼行數:10,代碼來源:TropoClassesTests.cs

示例3: testAskWithEvents

 public void testAskWithEvents()
 {
     Tropo tropo = new Tropo();
     string[] signals = new string[] { "endCall", "tooLong" };
     Say say = new Say("This is an Ask test with events. Please enter 1, 2 or 3.");
     Choices choices = new Choices("1,2,3");
     tropo.Ask(5, signals, false, choices, null, "test", true, say, 30);
     tropo.Hangup();
     Assert.AreEqual(this.askJsonWithEvents, tropo.RenderJSON());
 }
開發者ID:sanyaade,項目名稱:tropo-webapi-csharp,代碼行數:10,代碼來源:TropoClassesTests.cs

示例4: Page_Load

        protected void Page_Load(object sender, EventArgs e)
        {
            // Create a new instance of the Tropo object
            Tropo tropo = new Tropo();
            
            // Set the grammar to use when collecting input.
            Choices choices = new Choices("[5 DIGITS]");
            
            // Create an event handler for when the input collection is finished. Tropo will POST Result object JSON.
            On on = new On(Event.Continue, "http://my-web-application-url/post", new Say("Please hold."));

            // Call the ask method of the Tropo object and pass in values. 
            tropo.Ask(3, false, choices, null, "zip", true, new Say("Please enter your 5 digit zip code"), 5);
            tropo.On(on);

            // Render the JSON for Tropo to consume.
            Response.Write(tropo.RenderJSON());
        }
開發者ID:Shannon-McCoy,項目名稱:tropo-webapi-csharp,代碼行數:18,代碼來源:GetZipCode.aspx.cs

示例5: testAskWithOptions

        public void testAskWithOptions()
        {
            Say say = new Say("Please enter your 5 digit zip code.");
            Choices choices = new Choices("[5 DIGITS]");
            Ask ask = new Ask();
            ask.Choices = choices;
            ask.Name = "foo";
            ask.Say = say;
            ask.Timeout = 30;
            ask.Required = true;
            ask.MinConfidence = 30;
            ask.Attempts = 1;
            ask.Bargein = false;

            Tropo tropo = new Tropo();
            tropo.Ask(ask);
            Assert.AreEqual(this.askJsonWithOptions, tropo.RenderJSON());
        }
開發者ID:Shannon-McCoy,項目名稱:tropo-webapi-csharp,代碼行數:18,代碼來源:TropoClassesTests.cs

示例6: Page_Load

        protected void Page_Load(object sender, EventArgs e)
        {
            // Create a new instance of the Tropo object.
            Tropo tropo = new Tropo();

            // Create an array of signals - used to interupt the Ask.
            string[] signals = new string[] {"endCall", "tooLong"};

            // A prompt to use with the Ask.
            Say say = new Say("This is an Ask test with events. Please enter 1, 2 or 3.");

            // Choices for the Ask.
            Choices choices = new Choices("1,2,3");

            // Set up the dialog.
            tropo.Ask(5, signals, false, choices, null, "test", true, say, 30);
            tropo.Hangup();

            // Render the dialog JSON for Tropo to consume.
            Response.Write(tropo.RenderJSON());
        }
開發者ID:khalidabuhakmeh,項目名稱:tropo-webapi-csharp,代碼行數:21,代碼來源:AskTest.aspx.cs

示例7: Page_Load

        protected void Page_Load(object sender, EventArgs e)
        {
            // Create a new instance of the Tropo object.
            Tropo tropo = new Tropo();

            // Say an introductory message to the caller.
            tropo.Say("Welcome to the claim test application.");

            // Create new choices to use with Ask.
            Choices choices = new Choices("[5 DIGITS]");

            // Create new ask with desired prompt that will be sent to user.
            tropo.Ask(3, false, choices, null, "claim_id", true, new Say("Please enter your 5 digits claim ID."), 5);

            // Create On handlers for Tropo event.
            tropo.On(Event.Continue, "Answer.aspx", null);  // Fires when the user provides valid input.
            tropo.On(Event.Error, "Error.aspx", null);      // Fires when an error occurs.
            tropo.On(Event.Incomplete, "Error.aspx", null); // Fires when the user does not enter correct input.

            // Render JSON for Tropo to consume.
            Response.Write(tropo.RenderJSON());
        }
開發者ID:Shannon-McCoy,項目名稱:tropo-webapi-csharp,代碼行數:22,代碼來源:Ask.aspx.cs

示例8: testAskMethodWithAllArguements

 public void testAskMethodWithAllArguements()
 {
     Tropo tropo = new Tropo();
     tropo.Ask(1, false, new Choices("[5 DIGITS]"), 30, "foo", true, new Say("Please enter your 5 digit zip code."), 30);
     Assert.AreEqual(this.askJsonWithOptions, tropo.RenderJSON());
 }
開發者ID:nSource,項目名稱:tropo-webapi-csharp,代碼行數:6,代碼來源:TropoClassesTests.cs


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