示例#1
0
        /// <summary>
        /// Create a TreeNode and its subtrees for the <paramref name="obj"/> instance beeing a <see cref="JObject"/> instance.
        /// </summary>
        /// <param name="obj"></param>
        /// <param name="depth"></param>
        /// <returns></returns>
        public static TreeNode Create(JObject obj, int depth)
        {
            var node = new JObjectTreeNode(obj);

            if (depth != 1)
            {
                int remainingDepth = (depth == UnlimitedDepth ? UnlimitedDepth : depth - 1);
                node.Nodes.AddRange(obj.Properties()
                                    .Select(o => Create(o, remainingDepth))
                                    .ToArray()
                                    );
            }

            return(node);
        }
        /// <summary>
        /// Create a TreeNode and its subtrees for the <paramref name="obj"/> instance beeing a <see cref="JObject"/> instance.
        /// </summary>
        /// <param name="obj"></param>
        /// <param name="depth"></param>
        /// <returns></returns>
        public static TreeNode Create(JObject obj, int depth)
        {
            var node = new JObjectTreeNode(obj);

            if (depth != 1)
            {
                int remainingDepth = (depth == UnlimitedDepth ? UnlimitedDepth : depth - 1);
                node.Nodes.AddRange(obj.Properties()
                    .Select(o => Create(o, remainingDepth))
                    .ToArray()
                    );
            }

            return node;
        }
示例#3
0
 /// <summary>
 /// Copies a JProperty into a JObject as first child.
 /// </summary>
 /// <param name="sourceNode"></param>
 /// <param name="targetNode"></param>
 private void DoDragDropCopy(JPropertyTreeNode sourceNode, JObjectTreeNode targetNode)
 {
     sourceNode.ClipboardCopy();
     targetNode.ClipboardPasteInto();
 }
示例#4
0
 /// <summary>
 /// Copies a JObject into a JArray as first child.
 /// </summary>
 /// <param name="sourceNode"></param>
 /// <param name="targetNode"></param>
 private void DoDragDropMove(JObjectTreeNode sourceNode, JArrayTreeNode targetNode)
 {
     sourceNode.ClipboardCut();
     targetNode.ClipboardPasteInto();
 }
示例#5
0
 /// <summary>
 /// Copies a JObject into a JArray as first child.
 /// </summary>
 /// <param name="sourceNode"></param>
 /// <param name="targetNode"></param>
 private void DoDragDropMove(JObjectTreeNode sourceNode, JArrayTreeNode targetNode)
 {
     sourceNode.ClipboardCut();
     targetNode.ClipboardPasteInto();
 }
示例#6
0
 /// <summary>
 /// Copies a JProperty into a JObject as first child.
 /// </summary>
 /// <param name="sourceNode"></param>
 /// <param name="targetNode"></param>
 private void DoDragDropCopy(JPropertyTreeNode sourceNode, JObjectTreeNode targetNode)
 {
     sourceNode.ClipboardCopy();
     targetNode.ClipboardPasteInto();
 }