示例#1
0
 public ViewCurrent(IGraphRuntime runtime)
     : base(runtime, ModuleKind.ViewModule)
 {
     this.inputPin = AddInputPin("Input", PinDataTypeFactory.FromType(typeof(ISequence <string>), string.Empty, WellKnownEditors.Hidden, null, null), PropertyMode.Never);
     this.data     = AddInputPin("data", PinDataTypeFactory.CreateString(), PropertyMode.Always);
     EnableVirtualOutputPin();
 }
示例#2
0
        private static IPinDataType CreateTargetPinDataType(ConvertTypeCode typeCode)
        {
            switch (typeCode)
            {
            case ConvertTypeCode.Any:
                return(PinDataTypeFactory.CreateAny());;

            case ConvertTypeCode.Boolean:
                return(PinDataTypeFactory.CreateBoolean());

            case ConvertTypeCode.Byte:
                return(PinDataTypeFactory.FromType(typeof(byte)));

            case ConvertTypeCode.Int16:
                return(PinDataTypeFactory.FromType(typeof(short)));

            case ConvertTypeCode.Int32:
                return(PinDataTypeFactory.CreateInt32());

            case ConvertTypeCode.Int64:
                return(PinDataTypeFactory.FromType(typeof(long)));

            case ConvertTypeCode.Float32:
                return(PinDataTypeFactory.FromType(typeof(float)));

            case ConvertTypeCode.Float64:
                return(PinDataTypeFactory.FromType(typeof(double)));

            case ConvertTypeCode.String:
                return(PinDataTypeFactory.CreateString());
            }

            return(PinDataTypeFactory.Create <object>());
        }
示例#3
0
文件: If.cs 项目: Xamla/graph_system
        public If(IGraphRuntime runtime)
            : base(runtime)
        {
            this.flowMode = FlowMode.WaitAny;
            this.AddInputPin("flowIn", PinDataTypeFactory.CreateFlow(), PropertyMode.Never);
            this.condition = this.AddInputPin("condition", PinDataTypeFactory.CreateString("x > 0"), PropertyMode.Default);
            this.arguments = new DynamicInputPin(runtime, base.inputs, "x", PinDataTypeFactory.CreateAny(), OnDynamicInputAdd)
            {
                Renameable = true
            };
            this.AddInterfacePin("x");
            this.trueOut  = this.AddOutputPin("true", PinDataTypeFactory.CreateFlow(), 1);
            this.falseOut = this.AddOutputPin("false", PinDataTypeFactory.CreateFlow(), 1);

            this.DynamicDisplayName = new DynamicDisplayNameFunc(FormatDisplayName);
        }
示例#4
0
 public ForceType(IGraphRuntime runtime)
     : base(runtime)
 {
     this.input  = AddInputPin("Input", PinDataTypeFactory.CreateAny(), PropertyMode.Never);
     this.output = AddOutputPin("Output", PinDataTypeFactory.CreateAny());
     this.type   = AddInputPin("Type", PinDataTypeFactory.CreateString("System.Object"), PropertyMode.Always);
     this.properties[this.type.Id].WhenNodeEvent.OfType <PropertyChangedEvent>().Subscribe(x =>
     {
         var genericInputType = Type.GetType((string)x.Value.Value, false, true) ?? typeof(object);
         var dataType         = PinDataTypeFactory.FromType(genericInputType);
         var errors           = input.ChangeType(dataType).Concat(output.ChangeType(dataType));
         if (errors.Any())
         {
             throw new AggregateException("One or more connections could not be reestablished after a data type change.", errors);
         }
     });
 }
示例#5
0
 public Throw(IGraphRuntime runtime)
     : base(runtime)
 {
     this.AddInputPin("Message", PinDataTypeFactory.CreateString("An unspecified error occured."), PropertyMode.Default);
 }