PinChanged (Event)


Node Information
Fires when the specified Serial Port pin changed.
General Information
• This node doesn't have other available options.
Visual
Visual

Ports
Text Type DataType Accepts IsList CustomAcception
SerialPort IN SerialPort ONE FALSE FALSE
OUT RUN MULTIPLE FALSE FALSE
ReAttachEvent IN RUN MULTIPLE FALSE FALSE

Source
namespace Korduene.KGraph.Nodes.IO.SerialPort
{
    [IsNode("PinChanged (Event)")]
    public class PinChanged : Node
    {
        Port serial = new Port(PortType.IN, typeof(System.IO.Ports.SerialPort), AcceptsLinks.ONE, "SerialPort");
        Port run = new Port(PortType.OUT, typeof(RUN), AcceptsLinks.MULTIPLE);
        Port attach = new Port(PortType.IN, typeof(RUN), AcceptsLinks.MULTIPLE, "ReAttachEvent");
        public PinChanged()
        {
            Name = "PinChanged (Event)";
            NodeType = KGraph.NodeType.Method;
            AddPort(serial);
            AddPort(run);
            AddPort(attach);
            Parameters.AddParameter(new NodeParameterInfo(typeof(object), "sender"));
            Parameters.AddParameter(new NodeParameterInfo(typeof(System.IO.Ports.SerialPinChangedEventArgs), "e"));
            Information = "Fires when the specified Serial Port pin changed.";
        }
        public override string Code()
        {
            return GetValue(run);
        }
        public override string ConstructorCode()
        {
            string serialobj = GetValue(serial);
            return serialobj + ".PinChanged += " + this.ID + ";";
        }
        public override void UpdateResults()
        {
            attach.Instructions = GetValue(serial) + ".PinChanged += " + this.ID + ";";
            if (!serial.IsConnected)
            {
                ErrorMessage = "No Serial Port is connected.";
                Status = NodeStatus.ERROR;
                return;
            }
            else
            {
                Status = NodeStatus.OK;
            }
        }
    }
}