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

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

            return(node);
        }
Esempio n. 2
0
 /// <summary>
 /// Copies a JProperty into a JObject as first child.
 /// </summary>
 /// <param name="sourceNode"></param>
 /// <param name="targetNode"></param>
 private void DoDragDropMove(JPropertyTreeNode sourceNode, JObjectTreeNode targetNode)
 {
     sourceNode.ClipboardCut();
     targetNode.ClipboardPasteInto();
 }