当前位置: 首页>>代码示例>>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;未经允许,请勿转载。