Key Down


Node Information
This event fires when the specifed keys is pressed. In the properties window set Key or key combination.
Note: for this to work you need to make sure the 'KeyPreview' property of the form is set to True.
General Information
• This node doesn't have other available options.
Visual
Visual

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

Source
namespace Korduene.KGraph.Nodes.Application.Events
{
    [IsNode("Key Down")]
    public class KeyDownEvent : Node
    {
        Port run = new Port(PortType.OUT, typeof(RUN), AcceptsLinks.MULTIPLE, "Execute");
        public System.Windows.Forms.Keys Key
        {
            set { Settings[0] = value.ToString(); }
            get { return (System.Windows.Forms.Keys)Enum.Parse(typeof(System.Windows.Forms.Keys), Settings[0]); }
        }
        public KeyDownEvent()
        {
            Name = "Key Down";
            NodeType = KGraph.NodeType.KeyDownEvent;
            Key = System.Windows.Forms.Keys.A;
            AddPort(run);
            Information = "This event fires when the specifed keys is pressed. In the properties window " +
                "set Key or key combination.\r\nNote: for this to work you need to " +
                "make sure the 'KeyPreview' property of the form is set to True.";
        }
        public override string Code()
        {
            return "if (" + GraphCore.ResolveKeysEnum(Key) + ")\r\n{\r\n" + GetValue(run) + "}"; ;
        }
    }
}