JSONTools.JSONObject.BuildTree C# (CSharp) Method

BuildTree() public method

public BuildTree ( ) : void
return void
        public void BuildTree()
        {
            if (this.TreeNode == null) { return; }
            this.TreeNode.Nodes.Clear();
            if (NodeMenu != null) { this.TreeNode.ContextMenuStrip = NodeMenu; }

            foreach (JSONObject child in this.ChildJSONObjects)
            {
                if (string.IsNullOrEmpty(child.Name))
                {
                    child.Name = this.TreeNode.Nodes.Count.ToString();
                    child.TreeNode.Text = child.Name;
                }
                child.NodeMenu = this.NodeMenu;
                this.TreeNode.Nodes.Add(child.TreeNode);
                child.BuildTree();
            }
            this.SetImage();
        }

Same methods

JSONObject::BuildTree ( TreeView Tree ) : void

Usage Example

Example #1
0
        private void LoadFile(string FileName)
        {
            JSONFile file = new JSONFile(FileName);
            rootObject = file.Open();
            rootObject.NodeMenu = this.NodeMenu;
            rootObject.BuildTree(Tree);
            CurrentObject = rootObject;
            UpdateTabs();

            settings.LastFilePath = FileDialog.FileName;
            this.Text = "JSONTools - " + settings.LastFilePath;
            hasChanged = false;
        }