Get Control Properties


Node Information
Gets properties of the specifed control. Click on the info button for available properties.
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
Get IN Object ONE FALSE FALSE

Source
namespace Korduene.KGraph.Nodes.UI.Control
{
    [IsNode("Get Properties")]
    public class ControlGetProperties : Node
    {
        Port objectRefIn = new Port(PortType.IN, typeof(object), AcceptsLinks.ONE, "Get");
        public ControlGetProperties()
        {
            this.Name = "Get Control Properties";
            this.OptionsAvilable = true;
            AddPort(objectRefIn);
            Information = "Gets properties of the specifed control. Click on the info button for available properties.";
            CreateContextMenu();
        }
        public void CreateContextMenu()
        {
            if (ReferenceType == typeof(object))
            {
                return;
            }
            InfoContextMenu = GetObjectPropertiesMenu(ReferenceType, false);
        }
        public override void OnPropertiesMenuSelected(ObjectPropertyInfo opi)
        {
            Port newport = new Port(PortType.OUT, opi.DataType, AcceptsLinks.MULTIPLE, opi.Name, true);
            newport.DataType = opi.DataType;
            newport.IsRemovable = true;
            newport.Instructions = "init";
            AddPort(newport);
        }
        public override void UpdateResults()
        {
            foreach (var port in Ports)
            {
                if (port.IsExtra)
                {
                    port.Instructions = ReferenceName + "." + port.Text;
                }
            }
            if (objectRefIn.IsConnected)
            {
                Port connectingport = objectRefIn.ConnectedPorts[0];
                if (connectingport.DataType != typeof(object))
                {
                    ReferenceType = connectingport.DataType;
                    if (string.IsNullOrWhiteSpace(connectingport.ParentNode.ReferenceName))
                    {
                        ReferenceName = connectingport.ID;
                    }
                    else
                    {
                        ReferenceName = connectingport.ParentNode.ReferenceName;
                    }
                }
                CreateContextMenu();
            }
            else
            {
                ReferenceName = string.Empty;
                if (InfoContextMenu != null)
                {
                    InfoContextMenu.Visibility = System.Windows.Visibility.Collapsed;
                }
            }
        }
    }
}