Example #1
0
        public Delay(IGraphRuntime runtime)
            : base(runtime)
        {
            this.inputPin  = AddInputPin("Input", PinDataTypeFactory.FromType(typeof(ISequence <>)), PropertyMode.Never);
            this.delayPin  = AddInputPin("Delay", PinDataTypeFactory.CreateTimeSpan(), PropertyMode.Default);
            this.outputPin = AddOutputPin("Output", PinDataTypeFactory.FromType(typeof(ISequence <>)));

            this.inputPin.WhenNodeEvent.Subscribe(evt =>
            {
                PinConnectionChangeEventHandler.ConnectionSensitivePinDataType(evt, PinDataTypeFactory.FromType(typeof(ISequence <>)), true, pinDataType =>
                {
                    var genericType = pinDataType.UnderlyingType.GenericTypeArguments.FirstOrDefault();

                    if (genericType != null)
                    {
                        genericDelegate = new GenericDelegate <Func <object, object, object> >(this, EvaluateInternalAttribute.GetMethod(GetType()).MakeGenericMethod(genericType));
                    }
                    else
                    {
                        genericDelegate = null;
                    }

                    outputPin.ChangeType(pinDataType);
                });
            });
        }
Example #2
0
 public Interval(IGraphRuntime runtime)
     : base(runtime)
 {
     this.periodPin = AddInputPin("Period", PinDataTypeFactory.CreateTimeSpan(), PropertyMode.Default);
     this.outputPin = AddOutputPin("Output", PinDataTypeFactory.Create <ISequence <long> >());
 }