Branch


Node Information
Branches out IN connections to up to ten OUT connections. This node can have one IN port that accepts multiple connections and up to 10 OUT ports that also accept multiple connections. Calls will be made from IN to OUT according to port positions starting from top to bottom. If there are unconnected ports, they will be ignored.
General Information
• This node has other options, you can view them by clicking on the info button, this also means according to the node you might be able to add more ports than what is already listed.
Visual
Visual

Ports
Text Type DataType Accepts IsList CustomAcception
Execute IN RUN MULTIPLE FALSE FALSE

Source
namespace Korduene.KGraph.Nodes.Utilities
{
    [IsNode("Branch")]
    public class Branch : Node
    {
        Port run = new Port(PortType.IN, typeof(RUN), AcceptsLinks.MULTIPLE, "Execute");
        public Branch()
        {
            Name = "Branch";
            NodeType = KGraph.NodeType.Method;
            AddPort(run);
            Information = "Branches out IN connections to up to ten OUT connections. "
                + "This node can have one IN port that accepts multiple connections and up to 10 " +
                "OUT ports that also accept multiple connections. Calls will be made from IN to OUT according to port positions starting from top to bottom. " +
                "If there are unconnected ports, they will be ignored.";
            OptionsAvilable = true;
            IsInfoMenuEnabled = true;
            InfoButton.Click += infoButton_Click;
        }
        private void infoButton_Click(object sender, System.Windows.RoutedEventArgs e)
        {
            if (IsInfoMenuEnabled)
            {
                string porttext = GetABC(PortOutCount());
                Port p = new Port(PortType.OUT, typeof(RUN), AcceptsLinks.MULTIPLE, porttext, true);
                p.IsRemovable = true;
                p.CanEditText = true;
                AddPort(p);
            }
        }
        public override string Code()
        {
            string code = string.Empty;
            foreach (var p in Ports)
            {
                if (p.PortType == PortType.OUT)
                {
                    if (p.IsConnected)
                    {
                        code += GetValue(p);
                    }
                }
            }
            return code;
        }
    }
}