当前位置: 首页>>代码示例>>C#>>正文


C# XNode.Interfaces方法代码示例

本文整理汇总了C#中System.Xml.Linq.XNode.Interfaces方法的典型用法代码示例。如果您正苦于以下问题:C# XNode.Interfaces方法的具体用法?C# XNode.Interfaces怎么用?C# XNode.Interfaces使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在System.Xml.Linq.XNode的用法示例。


在下文中一共展示了XNode.Interfaces方法的3个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。

示例1: Apply

        protected virtual void Apply(XNode node, JsonSerializer serializer, JObject obj)
        {
            Contract.Requires<ArgumentNullException>(node != null);
            Contract.Requires<ArgumentNullException>(serializer != null);
            Contract.Requires<ArgumentNullException>(obj != null);

            RemotesToObject(node.Interfaces<object>(), obj, serializer);
        }
开发者ID:nxkit,项目名称:nxkit,代码行数:8,代码来源:RemoteXNodeJsonConverter.cs

示例2: GetRemoteDescriptor

        /// <summary>
        /// Gets the <see cref="RemoteDescriptor"/> for the given remote interface on the given <see cref="XNode"/>.
        /// </summary>
        /// <param name="node"></param>
        /// <param name="interfaceName"></param>
        /// <returns></returns>
        static RemoteDescriptor GetRemoteDescriptor(XNode node, string interfaceName)
        {
            Contract.Requires<ArgumentNullException>(node != null);
            Contract.Requires<ArgumentException>(!string.IsNullOrWhiteSpace(interfaceName));

            return RemoteObjectJsonConverter.GetRemotes(node.Interfaces<object>())
                .FirstOrDefault(i => i.Type.FullName == interfaceName);
        }
开发者ID:nxkit,项目名称:nxkit,代码行数:14,代码来源:RemoteHelper.cs

示例3: InvokeListeners

        /// <summary>
        /// Invokes the applicable listeners for this node.
        /// </summary>
        /// <param name="node"></param>
        /// <param name="evt"></param>
        void InvokeListeners(XNode node, Event evt)
        {
            Contract.Requires<ArgumentNullException>(node != null);
            Contract.Requires<ArgumentNullException>(evt != null);

            // Initialize event's currentTarget attribute to the object for which these steps are run.
            evt.currentTarget = node;

            // invoke registered listeners
            foreach (var registration in node.Interface<EventTarget>().state.registrations)
            {
                // If event's stop immediate propagation flag is set, terminate the invoke algorithm.
                if (evt.stopImmediatePropagation)
                    return;

                // If event's type attribute value is not listener's type, terminate these substeps (and run them for
                // the next event listener).
                if (evt.type != registration.EventType)
                    continue;

                // If event's eventPhase attribute value is CAPTURING_PHASE and listener's capture is false, terminate
                // these substeps (and run them for the next event listener).
                if (evt.eventPhase == EventPhase.Capturing && registration.Capture == false)
                    continue;

                // If event's eventPhase attribute value is BUBBLING_PHASE and listener's capture is true, terminate
                // these substeps (and run them for the next event listener).
                if (evt.eventPhase == EventPhase.Bubbling && registration.Capture == true)
                    continue;

                // Call listener's callback's handleEvent, with the event passed to this algorithm as the first
                // argument and event's currentTarget attribute value as callback this value.
                invoker.Invoke(() =>
                    registration.Listener.HandleEvent(evt));
            }

            // invoke listeners available directly as interfaces
            foreach (var listener in node.Interfaces<IEventListener>())
            {
                // If event's stop immediate propagation flag is set, terminate the invoke algorithm.
                if (evt.stopImmediatePropagation)
                    return;

                invoker.Invoke(() =>
                    listener.HandleEvent(evt));
            }
        }
开发者ID:nxkit,项目名称:nxkit,代码行数:52,代码来源:EventTarget.cs


注:本文中的System.Xml.Linq.XNode.Interfaces方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。