Enable/Disable


Node Information
Enables or disables one or multiple form controls.
General Information
• This node doesn't have other available options.
Visual
Visual

Ports
Text Type DataType Accepts IsList CustomAcception
Set IN RUN MULTIPLE FALSE FALSE
Controls IN Object MULTIPLE FALSE FALSE
Enable IN Boolean ONE FALSE FALSE

Source
namespace Korduene.KGraph.Nodes.UI.Control
{
    [IsNode("Enable/Disable")]
    public class ControlEnableDisable : Node
    {
        Port run = new Port(PortType.IN, typeof(RUN), AcceptsLinks.MULTIPLE, "Set");
        Port objectRef = new Port(PortType.IN, typeof(object), AcceptsLinks.MULTIPLE, "Controls");
        Port enable = new Port(PortType.IN, typeof(bool), AcceptsLinks.ONE, "Enable");
        public bool Enable
        {
            set { enable.Value = value.ToString(); }
            get { return GetRuntimeValue(enable); }
        }
        public ControlEnableDisable()
        {
            this.Name = "Enable/Disable";
            this.NodeType = KGraph.NodeType.Method;
            AddPort(run);
            AddPort(objectRef);
            AddPort(enable);
            Information = "Enables or disables one or multiple form controls.";
        }
        public override string Code()
        {
            string code = string.Empty;
            string val = GetValue(enable);
            if (objectRef.ConnectedPorts.Count !=0)
            {
                foreach (var port in objectRef.ConnectedPorts)
                {
                    if (port != null)
                    {
                        code += port.ParentNode.ReferenceName + ".Enabled =" + val.ToLower() + ";";
                    }
                }
            }
            return code;
        }
    }
}