Exemplo n.º 1
0
        /// <summary>
        /// Creates a link to another DebugNode.
        /// </summary>
        /// <param name="node">The Node to link to.</param>
        /// <returns>The link as HLink.</returns>
        public static HLink GetLink(DebugResponseNode node)
        {
            if (node == null)
            {
                throw new ArgumentNullException(nameof(node));
            }

            return(GetLink(node.Name, node.URL));
        }
Exemplo n.º 2
0
        /// <inheritdoc />
        public override HElement GetContents(SessionData sessionData, string requestedAction, WalkableQueue <Tuple <ID, string> > positionQueue)
        {
            if (positionQueue.AtEnd())
            {
                HElement list = new HList(HList.EListType.UnorderedList, (from s in _subNodes select GetLink(s.Value.Name, s.Key, positionQueue, positionQueue.Position, null)).ToArray())
                {
                    Class = "subnodes"
                };

                if (((HList)list).IsEmpty())
                {
                    list = new HItalic("This DebugNode includes no Subnodes.")
                    {
                        Class = "subnodes"
                    }
                }
                ;
                else
                {
                    list = new HHeadline("Subnodes of this DebugNode", 3)
                    {
                        Class = "subnodes"
                    }
                } +list;

                return(new HHeadline(Name) + new HLine()
                {
                    Class = "start"
                } +(_description == null ? new HText(_description) : (HElement) new HString()) + new HContainer(GetElements(sessionData)) + new HLine()
                {
                    Class = "subnodes"
                } +list);
            }
            else
            {
                HLink navlink = GetLink(this);
                navlink.Class = "nav";
                HInlineContainer name = new HInlineContainer()
                {
                    Elements = { navlink }
                };

                DebugResponseNode node = null;

                positionQueue.Pop();

                if (_subNodes)
                {
                    node = _subNodes[positionQueue.Peek().Item1];
                }

                if (ReferenceEquals(node, null))
                {
                    HElement list = new HList(HList.EListType.UnorderedList, (from s in _subNodes select GetLink(s.Value.Name, s.Value.URL)).ToArray())
                    {
                        Class = "subnodes"
                    };

                    if (((HList)list).IsEmpty())
                    {
                        list = new HItalic("This DebugNode includes no Subnodes.")
                        {
                            Class = "subnodes"
                        }
                    }
                    ;
                    else
                    {
                        list = new HHeadline("Subnodes of this DebugNode", 3)
                        {
                            Class = "subnodes"
                        }
                    } +list;

                    return(name + new HHeadline(Name) + new HLine()
                    {
                        Class = "start"
                    } +new HText($"The ID '{positionQueue.Peek().Item1.Value}' is not a child of this {nameof(DebugContainerResponseNode)}.")
                    {
                        Class = "invalid"
                    } +new HLine()
                    {
                        Class = "subnodes"
                    } +list);
                }
                else
                {
                    return(name + node.GetContents(sessionData, positionQueue.Peek().Item2, positionQueue));
                }
            }
        }
Exemplo n.º 3
0
 /// <summary>
 /// Removes a specified node from the sub-nodes of this node.
 /// </summary>
 /// <param name="node">The node to remove from the subnodes.</param>
 public void RemoveNode(DebugResponseNode node)
 {
     _subNodes.Remove(new KeyValuePair <ID, DebugResponseNode>(node.ID, node));
 }
Exemplo n.º 4
0
 /// <summary>
 /// Adds a specified node as sub-node of this node.
 /// </summary>
 /// <param name="node">The node to add as subnode.</param>
 public void AddNode(DebugResponseNode node)
 {
     node.SetParentURL(this);
     _subNodes.Add(node.ID, node);
 }
Exemplo n.º 5
0
 /// <summary>
 /// Removes a node from the static DebugNode.
 /// </summary>
 /// <param name="node">The node to remove.</param>
 public static void RemoveNode(DebugResponseNode node)
 {
     _debugNode.RemoveNode(node);
 }
Exemplo n.º 6
0
 /// <summary>
 /// Adds a node to the static DebugNode.
 /// </summary>
 /// <param name="node">The node to add.</param>
 public static void AddNode(DebugResponseNode node)
 {
     _debugNode.AddNode(node);
 }