JSONTools.JSONObject.SetImage C# (CSharp) Method

SetImage() public method

public SetImage ( ) : void
return void
        public void SetImage()
        {
            if (this.ValueType != JSONType.Object && this.ValueType != JSONType.ObjectArray) { return; }
            if (this.ContainsOnlyObjects && this.ChildJSONObjects.Count > 1)
            {
                this.TreeNode.ImageIndex = 2;
                this.TreeNode.SelectedImageIndex = 2;
                this.ValueType = JSONType.ObjectArray;
            }
            else if (this.ContainsObjects)
            {
                this.TreeNode.ImageIndex = 0;
                this.TreeNode.SelectedImageIndex = 0;
                this.ValueType = JSONType.Object;
            }
            else
            {
                this.TreeNode.ImageIndex = 1;
                this.TreeNode.SelectedImageIndex = 1;
                this.ValueType = JSONType.Object;
            }
        }

Usage Example

Example #1
0
 public JSONObject AddNode()
 {
     JSONObject child = new JSONObject();
     child.Parent = this;
     child.ValueType = JSONType.Object;
     this.ChildObjects.Add(child);
     if (NodeMenu != null) { child.NodeMenu = NodeMenu; child.TreeNode.ContextMenuStrip = NodeMenu; }
     child.SetImage();
     this.TreeNode.Nodes.Add(child.TreeNode);
     this.TreeNode.Expand();
     this.SetImage();
     return child;
 }