Пример #1
0
        private void AddOutput(NodeInputConfig inputConfig, GenericNode node = null)
        {
            if (!IsVisible(inputConfig.Visibility))
            {
                return;
            }
            var nodeToUse = node ?? GraphItem;
            var header    = new InputOutputViewModel();

            header.Name       = inputConfig.Name.GetValue(node);
            header.DataObject = inputConfig.IsAlias
                ? DataObject
                : inputConfig.GetDataObject(nodeToUse);
            header.OutputConnectorType = inputConfig.SourceType;
            header.IsInput             = false;
            header.IsOutput            = true;
            if (inputConfig.AttributeInfo != null)
            {
                header.IsNewLine = inputConfig.AttributeInfo.IsNewRow;
            }
            else
            {
                header.IsNewLine = true;
            }
            ContentItems.Add(header);
            ApplyOutputConfiguration(inputConfig, header.DataObject as IGraphItem, header.OutputConnector, true);
            if (header.InputConnector != null)
            {
                header.OutputConnector.Configuration = inputConfig;
            }
        }
Пример #2
0
 public NodeConfig<TNode> InputAlias(string inputName)
 {
     var config = new NodeInputConfig()
     {
         Name = new ConfigProperty<IDiagramNodeItem, string>(inputName),
         IsInput = true,
         IsOutput = false,
         SourceType = typeof(TNode),
         ReferenceType = typeof(TNode),
         IsAlias = true
     };
     GraphItemConfigurations.Add(config);
     return this;
 }
Пример #3
0
 public NodeConfig<TNode> Input<TSourceType, TReferenceType>(Func<IDiagramNodeItem, string> name, bool allowMultiple, Func<IDiagramNodeItem, IDiagramNodeItem, bool> validator = null)
     where TReferenceType : GenericSlot, new()
     where TSourceType : class, IConnectable
 {
     var config = new NodeInputConfig()
     {
         Name = new ConfigProperty<IDiagramNodeItem, string>(name),
         IsInput = true,
         IsOutput = false,
         ReferenceType = typeof(TReferenceType),
         SourceType = typeof(TSourceType),
         Validator = validator
     };
     GraphItemConfigurations.Add(config);
     return this;
 }
Пример #4
0
        private GraphItemConfiguration CreateSlotConfiguration(PropertyInfo property, Slot slot)
        {
            var config = new NodeInputConfig()
            {
                Name          = new ConfigProperty <IDiagramNodeItem, string>(slot.Name),
                IsInput       = slot is InputSlot,
                IsOutput      = slot is OutputSlot,
                Visibility    = slot.Visibility,
                ReferenceType = property.PropertyType,
                SourceType    = slot.SourceType ?? property.PropertyType.GetGenericParameter(),
                PropertyInfo  = property,
                AttributeInfo = slot,
                Tint          = slot.Tint,
                Style         = slot.Style
            };

            return(config);
        }