Beispiel #1
0
        public void UpdatePorts()
        {
            if (string.IsNullOrEmpty(GetFunctionName()))
            {
                return;
            }
            var ctx           = Context.GetContext();
            var function      = ctx.GetFunction(GetFunctionName());
            var existingNames = new HashSet <string>(InstancePorts.Select(p => p.fieldName));

            foreach (var input in function?.Inputs ?? Array.Empty <Element.PortInfo>())
            {
                // TODO: Different types for different Element types
                var type = typeof(ElementNodeValue);
                if (existingNames.Remove(input.Name))
                {
                    GetPort(input.Name).ValueType = type;
                }
                else
                {
                    AddInstanceInput(type, ConnectionType.Multiple, input.Name);
                }
            }
            if (function != null && function.Inputs == null)
            {
                for (int i = 0; i < GetVaradicCount(); i++)
                {
                    AddInstanceInput(typeof(object), ConnectionType.Multiple, $"${i}");
                }
            }
            foreach (var name in existingNames)
            {
                RemoveInstancePort(name);
            }
        }
Beispiel #2
0
        private void GetBranchingNodePortList()
        {
            var portFiltered = InstancePorts.ToList();

            branchPorts = portFiltered
                          .Where(x => x.ValueType == typeof(ChoiceBranch))
                          .ToList();
        }
Beispiel #3
0
 private void BindExecutionsToButtons()
 {
     buttonPorts = InstancePorts
                   .ToList()
                   .Where(x => x.IsConnected && x.Connection.node.GetType().IsSubclassOf(typeof(AbstractExecutionNode)))
                   .ToList();
     for (int i = 0; i < buttonPorts.Count; i++)
     {
         ExecuteCommandsInPort(i);
     }
 }