ComboBox Add Item


Node Information
Adds item to the specified ComboBox.
General Information
• This node doesn't have other available options.
Visual
Visual

Ports
Text Type DataType Accepts IsList CustomAcception
Add IN RUN MULTIPLE FALSE FALSE
ComboBox IN ComboBox ONE FALSE FALSE
Value IN String ONE FALSE FALSE
Image IN Image ONE FALSE FALSE

Source
namespace Korduene.KGraph.Nodes.UI.ComboBox
{
    [IsNode("Add Item")]
    public class ComboBoxAdd : Node
    {
        Port run = new Port(PortType.IN, typeof(RUN), AcceptsLinks.MULTIPLE, "Add");
        Port val = new Port(PortType.IN, typeof(string), AcceptsLinks.ONE, "Value");
        Port img = new Port(PortType.IN, typeof(System.Drawing.Image), AcceptsLinks.ONE, "Image");
        Port control = new Port(PortType.IN, typeof(Korduene.Designer.Standard.ComboBox), AcceptsLinks.ONE, "ComboBox");
        public ComboBoxAdd()
        {
            this.Name = "ComboBox Add Item";
            this.NodeType = KGraph.NodeType.Method;
            AddPort(run);
            AddPort(control);
            AddPort(val);
            AddPort(img);
            Information = "Adds item to the specified ComboBox.";
        }
        public override string Code()
        {
            if (img.IsConnected)
            {
                return GetValue(control) + ".Items.Add(new Korduene.Designer.Standard.ComboBoxItem(" + GetValue(val) + "," + GetValue(img) + "));";
            }
            return GetValue(control) + ".Items.Add(" + GetValue(val) + ");";
        }
    }
}