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


C# Tropo.Message方法代碼示例

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


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

示例1: ExecuteSession

        /// <summary>
        /// Must be used from an endpoint URL. 
        /// This will parse the active session and send the specified messages. 
        /// As of now, it only supports sending through the MSN Network IM
        /// </summary>
        /// <param name="reader"></param>
        /// <param name="messages"></param>
        /// <returns></returns>
        public static string ExecuteSession(StreamReader reader, Dictionary<string, List<string>> messages)
        {
            string sessionJSON = reader.ReadToEnd();
            Tropo tropo = new Tropo();
            try
            {
                Session tropoSession = new Session(sessionJSON);

                foreach (var kvp in messages)
                {
                    string to = kvp.Key;
                    string from = "[email protected]";

                    foreach (string msg in kvp.Value)
                    {
                        tropo.Message(new Say(msg), new List<string>() { to }, false, Channel.Text, from, from, Network.Msn, false, 30);
                    }
                }

            }
            catch
            {
            }
            return tropo.RenderJSON();
        }
開發者ID:Aralcom,項目名稱:Parking,代碼行數:33,代碼來源:Tropo.cs

示例2: Page_Load

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

            // Set the voice to use when saying a prompt.
            tropo.Voice = Voice.UsEnglishMale;

            // A prompt to give the say to the recipient.
            Say say = new Say("Remember you have a meeting at 2 PM");

            // An ArrayList to hold the numbers to call (first call answered hears the prompt).
            List<String> to = new List<String>();
            to.Add("3055195825");
            to.Add("3054445567");

            // Create an endpoint object to denote who the call is from.
            string from = "7777777777";

            // Call the message method of the Tropo object and pass in values.
            tropo.Message(say, to, false, Channel.Voice, from, "reminder", Network.Pstn, true, 60);

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

示例3: testMessageUseAllOptions

        public void testMessageUseAllOptions()
        {
            Say say = new Say("This is an announcement");
            Tropo tropo = new Tropo();
            tropo.Voice = Voice.BritishEnglishFemale;
            string from = "3055551212";
            List<String> to = new List<String>();
            to.Add("3055195825");
            tropo.Message(say, to, false, Channel.Text, from, "foo", Network.SMS, true, 10);

            Assert.AreEqual(this.messageJsonAllOptions, tropo.RenderJSON());
        }
開發者ID:nSource,項目名稱:tropo-webapi-csharp,代碼行數:12,代碼來源:TropoClassesTests.cs

示例4: testMessageFromObject

        public void testMessageFromObject()
        {
            Say say = new Say("This is an announcement");
            string from = "3055551212";
            Message message = new Message();
            List<String> to = new List<String>();
            to.Add("3055195825");
            message.Say = say;
            message.To = to;
            message.From = from;
            message.AnswerOnMedia = false;
            message.Channel = Channel.Text;
            message.Network = Network.SMS;
            message.Timeout = 10;

            Tropo tropo = new Tropo();
            tropo.Voice = Voice.BritishEnglishFemale;
            tropo.Message(message);

            Assert.AreEqual(this.messageJson, tropo.RenderJSON());
        }
開發者ID:nSource,項目名稱:tropo-webapi-csharp,代碼行數:21,代碼來源:TropoClassesTests.cs


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