TreeView Remove Node


Node Information
Removes node from the specified TreeView.
General Information
• This node doesn't have other available options.
Visual
Visual

Ports
Text Type DataType Accepts IsList CustomAcception
Remove IN RUN MULTIPLE FALSE FALSE
TreeView IN TreeView ONE FALSE FALSE
Value IN String ONE FALSE FALSE

Source
namespace Korduene.KGraph.Nodes.UI.TreeView
{
    [IsNode("Remove Node")]
    public class TreeViewRemove : Node
    {
        Port run = new Port(PortType.IN, typeof(RUN), AcceptsLinks.MULTIPLE, "Remove");
        Port val = new Port(PortType.IN, typeof(string), AcceptsLinks.ONE, "Value");
        Port control = new Port(PortType.IN, typeof(Korduene.Designer.Standard.TreeView), AcceptsLinks.ONE, "TreeView");
        public string Value
        {
            set { val.Value = value.ToString(); }
            get { return GetRuntimeValue(val); }
        }
        public TreeViewRemove()
        {
            this.Name = "TreeView Remove Node";
            this.NodeType = KGraph.NodeType.Method;
            AddPort(run);
            AddPort(control);
            AddPort(val);
            Information = "Removes node from the specified TreeView.";
        }
        public override string Code()
        {
            return "foreach (TreeNode n in " + GetValue(control) + ".Nodes){if (n.Text == " + GetValue(val) + "){" + GetValue(val) + ".Nodes.Remove(n); break; }}";
        }
    }
}