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


C# IQ.AddChild方法代碼示例

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


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

示例1: GetConfig

        /// <summary>
        /// Send message to HarmonyHub to request Configuration.
        /// Result is parsed by OnIq based on ClientCommandType
        /// </summary>
        public void GetConfig()
        {
            EnsureConnection();

            var iqToSend = new IQ { Type = IqType.get, Namespace = "", From = "1", To = "guest" };
            iqToSend.AddChild(HarmonyDocuments.ConfigDocument());
            iqToSend.GenerateId();

            var iqGrabber = new IqGrabber(Xmpp);
            var iq = iqGrabber.SendIq(iqToSend, 10000);

            if (iq != null)
            {
                var match = IdentityRegex.Match(iq.InnerXml);
                if (match.Success)
                {
                    RawConfig = match.Groups[1].ToString();
                    Config = null;
                    try
                    {
                        Config = new JavaScriptSerializer().Deserialize<HarmonyConfigResult>(RawConfig);
                    }
                    catch { }
                }
            }
        }
開發者ID:RossLieberman,項目名稱:alexitech,代碼行數:30,代碼來源:HarmonyClient.cs

示例2: SwapAuthToken

        /// <summary>
        /// Send message to HarmonyHub with UserAuthToken, wait for SessionToken
        /// </summary>
        /// <param name="userAuthToken"></param>
        /// <returns></returns>
        public string SwapAuthToken(string userAuthToken)
        {
            var iqToSend = new IQ { Type = IqType.get, Namespace = "", From = "1", To = "guest" };
            iqToSend.AddChild(HarmonyDocuments.LogitechPairDocument(userAuthToken));
            iqToSend.GenerateId();

            var iqGrabber = new IqGrabber(Xmpp);
            iqGrabber.SendIq(iqToSend, 10);

            WaitForData(5);

            return _sessionToken;
        }
開發者ID:slavikko,項目名稱:harmony,代碼行數:18,代碼來源:HarmonyAuthenticationClient.cs

示例3: SwapAuthToken

        /// <summary>
        /// Send message to HarmonyHub with UserAuthToken, wait for SessionToken
        /// </summary>
        /// <param name="userAuthToken"></param>
        /// <returns></returns>
        public string SwapAuthToken(string userAuthToken)
        {
            EnsureConnection();

            var iqToSend = new IQ { Type = IqType.get, Namespace = "", From = "1", To = "guest" };
            iqToSend.AddChild(HarmonyDocuments.LogitechPairDocument(userAuthToken));
            iqToSend.GenerateId();

            var iqGrabber = new IqGrabber(Xmpp);
            var iq = iqGrabber.SendIq(iqToSend, 5000);

            if (iq != null)
            {
                var match = IdentityRegex.Match(iq.InnerXml);
                if (match.Success)
                {
                    return match.Groups[1].ToString();
                }
            }

            return null;
        }
開發者ID:RossLieberman,項目名稱:alexitech,代碼行數:27,代碼來源:HarmonyAuthenticationClient.cs

示例4: GenerateIq

        /// <summary>
        ///     Generate an IQ for the supplied Document
        /// </summary>
        /// <param name="document">Document</param>
        /// <returns>IQ</returns>
        private static IQ GenerateIq(Document document)
        {
            // Create the IQ to send
            var iqToSend = new IQ
            {
                Type = IqType.get,
                Namespace = "",
                From = "1",
                To = "guest"
            };

            // Add the real content for the Harmony
            iqToSend.AddChild(document);

            // Generate an unique ID, this is used to correlate the reply to the request
            iqToSend.GenerateId();
            return iqToSend;
        }
開發者ID:Lakritzator,項目名稱:harmony,代碼行數:23,代碼來源:HarmonyClient.cs

示例5: StartActivity

        /// <summary>
        /// Send message to HarmonyHub to start a given activity
        /// Result is parsed by OnIq based on ClientCommandType
        /// </summary>
        /// <param name="activityId"></param>
        public void StartActivity(string activityId)
        {
            EnsureConnection();

            var iqToSend = new IQ { Type = IqType.get, Namespace = "", From = "1", To = "guest" };
            iqToSend.AddChild(HarmonyDocuments.StartActivityDocument(activityId));
            iqToSend.GenerateId();

            Xmpp.Send(iqToSend);
        }
開發者ID:RossLieberman,項目名稱:alexitech,代碼行數:15,代碼來源:HarmonyClient.cs

示例6: Sequence

        /// <summary>
        /// Send message to HarmonyHub to request to run a sequence
        /// Result is parsed by OnIq based on ClientCommandType
        /// </summary>
        /// <param name="deviceId"></param>
        /// <param name="command"></param>
        public void Sequence(int sequenceId)
        {
            EnsureConnection();

            var iqToSend = new IQ { Type = IqType.get, Namespace = "", From = "1", To = "guest" };
            iqToSend.AddChild(HarmonyDocuments.SequenceDocument(sequenceId));
            iqToSend.GenerateId();

            Xmpp.Send(iqToSend);
        }
開發者ID:RossLieberman,項目名稱:alexitech,代碼行數:16,代碼來源:HarmonyClient.cs

示例7: PressButton

        /// <summary>
        /// Send message to HarmonyHub to request to press a button
        /// Result is parsed by OnIq based on ClientCommandType
        /// </summary>
        /// <param name="deviceId"></param>
        /// <param name="command"></param>
        public void PressButton(string deviceId, string command)
        {
            EnsureConnection();

            var iqToSend = new IQ { Type = IqType.get, Namespace = "", From = "1", To = "guest" };
            iqToSend.AddChild(HarmonyDocuments.IRCommandDocument(deviceId, command));
            iqToSend.GenerateId();

            Xmpp.Send(iqToSend);
        }
開發者ID:RossLieberman,項目名稱:alexitech,代碼行數:16,代碼來源:HarmonyClient.cs

示例8: GetCurrentActivity

        /// <summary>
        /// Send message to HarmonyHub to request current activity
        /// Result is parsed by OnIq based on ClientCommandType
        /// </summary>
        public void GetCurrentActivity()
        {
            EnsureConnection();

            var iqToSend = new IQ { Type = IqType.get, Namespace = "", From = "1", To = "guest" };
            iqToSend.AddChild(HarmonyDocuments.GetCurrentActivityDocument());
            iqToSend.GenerateId();

            var iqGrabber = new IqGrabber(Xmpp);
            var iq = iqGrabber.SendIq(iqToSend, 5000);

            if (iq != null)
            {
                var match = IdentityRegex.Match(iq.InnerXml);
                if (match.Success)
                {
                    CurrentActivity = match.Groups[1].ToString().Split('=')[1];
                }
            }
        }
開發者ID:RossLieberman,項目名稱:alexitech,代碼行數:24,代碼來源:HarmonyClient.cs

示例9: GetConfig

        /// <summary>
        /// Send message to HarmonyHub to request Configuration.
        /// Result is parsed by OnIq based on ClientCommandType
        /// </summary>
        public void GetConfig()
        {
            _clientCommand = ClientCommandType.GetConfig;

            var iqToSend = new IQ { Type = IqType.get, Namespace = "", From = "1", To = "guest" };
            iqToSend.AddChild(HarmonyDocuments.ConfigDocument());
            iqToSend.GenerateId();

            var iqGrabber = new IqGrabber(Xmpp);
            iqGrabber.SendIq(iqToSend, 10);

            WaitForData(5);
        }
開發者ID:slavikko,項目名稱:harmony,代碼行數:17,代碼來源:HarmonyClient.cs

示例10: StartActivity

        /// <summary>
        /// Send message to HarmonyHub to start a given activity
        /// Result is parsed by OnIq based on ClientCommandType
        /// </summary>
        /// <param name="activityId"></param>
        public void StartActivity(string activityId)
        {
            _clientCommand = ClientCommandType.StartActivity;

            var iqToSend = new IQ { Type = IqType.get, Namespace = "", From = "1", To = "guest" };
            iqToSend.AddChild(HarmonyDocuments.StartActivityDocument(activityId));
            iqToSend.GenerateId();

            var iqGrabber = new IqGrabber(Xmpp);
            iqGrabber.SendIq(iqToSend, 10);

            WaitForData(5);
        }
開發者ID:slavikko,項目名稱:harmony,代碼行數:18,代碼來源:HarmonyClient.cs

示例11: PressButton

        /// <summary>
        /// Send message to HarmonyHub to request to press a button
        /// Result is parsed by OnIq based on ClientCommandType
        /// </summary>
        /// <param name="deviceId"></param>
        /// <param name="command"></param>
        public void PressButton(string deviceId, string command)
        {
            _clientCommand = ClientCommandType.PressButton;

            var iqToSend = new IQ { Type = IqType.get, Namespace = "", From = "1", To = "guest" };
            iqToSend.AddChild(HarmonyDocuments.IRCommandDocument(deviceId, command));
            iqToSend.GenerateId();

            var iqGrabber = new IqGrabber(Xmpp);
            iqGrabber.SendIq(iqToSend, 5);

            WaitForData(5);
        }
開發者ID:slavikko,項目名稱:harmony,代碼行數:19,代碼來源:HarmonyClient.cs


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