Get Form Properties


Node Information
Reference to the specifed object. 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
Form IN Form ONE FALSE FALSE

Source
namespace Korduene.KGraph.Nodes.UI.Form
{
    [IsNode("Get Properties")]
    public class FormProperties : Node
    {
        Port objectRef = new Port(PortType.IN, typeof(System.Windows.Forms.Form), AcceptsLinks.ONE, "Form");
        [System.ComponentModel.Description("if there is no forms connected the value will be set to the current form, which is refered to as 'this'.")]
        public string FormName
        {
            get { return "this"; }
        }
        public FormProperties()
        {
            this.Name = "Get Form Properties";
            this.OptionsAvilable = true;
            AddPort(objectRef);
            Information = "Reference to the specifed object. Click on the info button for available properties.";
            CreateContextMenu();
        }
        public void CreateContextMenu()
        {
            InfoContextMenu = GetObjectPropertiesMenu(typeof(System.Windows.Forms.Form), 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;
            AddPort(newport);
        }
        public override void UpdateResults()
        {
            ReferenceName = "this";
            if (objectRef.IsConnected)
            {
                ReferenceName = GetValue(objectRef);
            }
            else
            {
                ReferenceName = FormName;
            }
            objectRef.Instructions = ReferenceName;
            foreach (var prt in Ports)
            {
                if (prt != objectRef)
                {
                    prt.Instructions = ReferenceName + "." + prt.Text;
                }
            }
        }
    }
}