Beispiel #1
0
        public ReadableToV(IGraphRuntime runtime)
            : base(runtime)
        {
            this.targetTypePin = AddInputPin("TargetType", PinDataTypeFactory.CreateEnum <ConvertTypeCode>(ConvertTypeCode.Float64), PropertyMode.Always);
            this.outputPin     = AddOutputPin("Output", PinDataTypeFactory.FromType(typeof(V <>)));
            this.outputPin.ChangeType(CreateTargetPinDataType(ConvertTypeCode.Float64));
            this.data = AddInputPin("Input", PinDataTypeFactory.FromType(typeof(IReadable)), PropertyMode.Allow);

            this.delimiter = AddInputPin("Delimiter", PinDataTypeFactory.FromType(typeof(char), ','), PropertyMode.Default);

            this.properties[targetTypePin.Id].WhenNodeEvent.OfType <PropertyChangedEvent>().Subscribe(x =>
            {
                var targetTypeCode = (ConvertTypeCode)x.Value.Value;

                IPinDataType targetPinDataType = CreateTargetPinDataType(targetTypeCode);
                var errors = outputPin.ChangeType(targetPinDataType);
                if (errors.Any())
                {
                    throw new AggregateException("One or more connections could not be reestablished after a data type change.", errors);
                }
            });

            var del = (char)this.Properties.GetValue("Delimiter");
        }