コード例 #1
0
        protected override void SetupInterfaces()
        {
            ButtonPort = Input.AddPort(new InPort()
            {
                Name                 = "Button",
                Description          = "The button to be monitored",
                Types                = new string[] { "Button Controller" },
                ProcessConnection    = (OutPort otherPort) => {
                },
                ProcessDisconnection = (OutPort otherPort) => {
                },
            });
            ButtonEventsPort = Input.AddPort(new InPort()
            {
                Name                 = "ButtonEvents",
                Description          = "This port receives events from the subscribed button",
                Types                = new string[] { "Kick" },
                ProcessConnection    = (OutPort otherPort) => {
                },
                ProcessDisconnection = (OutPort otherPort) => {
                },
                Hidden               = true,
            });

            OnPressPort = Output.AddPort(new OutPort()
            {
                Name                 = "OnPress",
                Description          = "Sends a kick when the button is pressed",
                Types                = new string[] { "Kick" },
                ProcessConnection    = (InPort otherPort) => {
                },
                ProcessDisconnection = (InPort otherPort) => {
                },
            });
        }
コード例 #2
0
        protected override void SetupInterfaces()
        {
            ObjectPort = Input.AddPort(new InPort()
            {
                Name                 = "Object",
                Description          = "The object to send",
                Types                = new string[] { "All" },
                ProcessConnection    = (OutPort otherPort) => {
                },
                ProcessDisconnection = (OutPort otherPort) => {
                },
                RememberOnlyLatest   = true,
            });
            SendPort = Input.AddPort(new InPort()
            {
                Name                 = "Send",
                Description          = "Upon receiving anything on this port, the object is sent on",
                Types                = new string[] { "All" },
                ProcessConnection    = (OutPort otherPort) => {
                },
                ProcessDisconnection = (OutPort otherPort) => {
                },
            });

            OutPort = Output.AddPort(new OutPort()
            {
                Name                 = "Out",
                Description          = "The sent object",
                Types                = new string[] { "All" },
                ProcessConnection    = (InPort otherPort) => {
                },
                ProcessDisconnection = (InPort otherPort) => {
                },
            });
        }
コード例 #3
0
        public Action DisconnectOutPort(string portName, Edge edge)
        {
            OutPort port = Output.GetPort(portName);

            port.RemoveConnection(edge);
            return(() => {
                if (port.ProcessDisconnection != null)
                {
                    port.ProcessDisconnection.Invoke(edge.Target);
                }
            });
        }
コード例 #4
0
        public Action ConnectToOutPort(string portName, Edge edge)
        {
            OutPort port = Output.GetPort(portName);

            port.AddConnection(edge);
            edge.Source = port;
            return(() => {
                if (port.ProcessConnection != null)
                {
                    port.ProcessConnection.Invoke(edge.Target);
                }
            });
        }
コード例 #5
0
        protected override void SetupInterfaces()
        {
            DoorPort = Input.AddPort(new InPort()
            {
                Name                 = "Door",
                Description          = "The controller of the door to be used",
                Types                = new string[] { "Door Controller" },
                ProcessConnection    = (OutPort otherPort) => {
                },
                ProcessDisconnection = (OutPort otherPort) => {
                },
            });
            TogglePort = Input.AddPort(new InPort()
            {
                Name                 = "Toggle",
                Description          = "On receiving any input to this port, the door's state will be toggled",
                Types                = new string[] { "All" },
                ProcessConnection    = (OutPort otherPort) => {
                },
                ProcessDisconnection = (OutPort otherPort) => {
                },
            });
            DoorEventsPort = Input.AddPort(new InPort()
            {
                Name                 = "DoorEventsPort",
                Description          = "On receiving any input to this port, the door's state will be toggled",
                Types                = new string[] { "All" },
                ProcessConnection    = (OutPort otherPort) => {
                },
                ProcessDisconnection = (OutPort otherPort) => {
                },
                Hidden               = true,
            });

            StatePort = Output.AddPort(new OutPort()
            {
                Name                 = "State",
                Description          = "The state of the door is sent on when changed as Opened or Closed",
                Types                = new string[] { "Text" },
                ProcessConnection    = (InPort otherPort) => {
                },
                ProcessDisconnection = (InPort otherPort) => {
                },
            });
        }
コード例 #6
0
        protected override void SetupInterfaces()
        {
            DelayPort = Input.AddPort(new InPort()
            {
                Name                 = "Delay",
                Description          = "The period to wait before sending messages on",
                Types                = new string[] { "Number" },
                ProcessConnection    = (OutPort otherPort) => {
                },
                ProcessDisconnection = (OutPort otherPort) => {
                },
                RememberOnlyLatest   = true
            });

            InPort = Input.AddPort(new InPort()
            {
                Name                 = "In",
                Description          = "The data that will be sent on",
                Types                = new string[] { "All" },
                ProcessConnection    = (OutPort otherPort) => {
                },
                ProcessDisconnection = (OutPort otherPort) => {
                }
            });

            OutPort = Output.AddPort(new OutPort()
            {
                Name                 = "Out",
                Description          = "The delayed data",
                Types                = new string[] { "All" },
                ProcessConnection    = (InPort otherPort) => {
                },
                ProcessDisconnection = (InPort otherPort) => {
                },
            });
        }
コード例 #7
0
        protected override void SetupInterfaces()
        {
            EventNamePort = Input.AddPort(new InPort()
            {
                Name                 = "EventName",
                Description          = "The name of the event to listen for",
                Types                = new string[] { "Text" },
                ProcessConnection    = (OutPort otherPort) => {
                },
                ProcessDisconnection = (OutPort otherPort) => {
                },
                RememberOnlyLatest   = true
            });
            EventPort = Input.AddPort(new InPort()
            {
                Name                 = "Event",
                Description          = "The data that was sent with the event",
                Types                = new string[] { "All" },
                ProcessConnection    = (OutPort otherPort) => {
                },
                ProcessDisconnection = (OutPort otherPort) => {
                },
                Hidden               = true
            });

            OutPort = Output.AddPort(new OutPort()
            {
                Name                 = "Out",
                Description          = "Sends event data when an event of the given name is received",
                Types                = new string[] { "Text" },
                ProcessConnection    = (InPort otherPort) => {
                },
                ProcessDisconnection = (InPort otherPort) => {
                },
            });
        }
コード例 #8
0
 public void Send(OutPort port, object data, ExecutionContext context)
 {
     port.Send(data, context);
 }
コード例 #9
0
 public OutPort AddPort(OutPort port)
 {
     port.Component = Component;
     Ports.Add(port.Name, port);
     return(port);
 }