/// <summary> /// Initializes a new instance of the <see cref="BasicNode"/> class. /// </summary> /// <param name="context">The node context.</param> public InputSelector(INodeContext context) : base(context, INPUT_PREFIX) { context.ThrowIfNull("context"); mTypeService = context.GetService <ITypeService>(); // Initialize the input count, allowing range 2..99. mInputCount = mTypeService.CreateInt(PortTypes.Integer, "InputCount", 2); mInputCount.MinValue = 2; mInputCount.MaxValue = 50; // Initialize inputs using a helper function that grows/shrinks the list of inputs // whenever the input count is changed mInputs = new List <AnyValueObject>(); ListHelpers.ConnectListToCounter(mInputs, mInputCount, mTypeService.GetValueObjectCreator(PortTypes.Any, INPUT_PREFIX), updateOutputValues); // Initialize the input for the index of the input to select. mSelectIndexInput = mTypeService.CreateInt(PortTypes.Integer, "InputSelectIndex"); mSelectIndexInput.MinValue = 0; mSelectIndexInput.MaxValue = mInputCount.MaxValue - 1; mSelectIndexInput.ValueSet += updateOutputValues; // Initialize the selector for "send-on-select". mSelectAction = mTypeService.CreateEnum("ESelectAction2", "SelectAction2", mSelectActionValues, "ResendCurrent"); // Initialize the output mOutput = mTypeService.CreateAny(PortTypes.Any, "Output"); }
/// <summary> /// Initializes a new instance of the <see cref="BasicNode"/> class. /// </summary> /// <param name="context">The node context.</param> public OutputSelector(INodeContext context) : base(context, OUTPUT_PREFIX) { context.ThrowIfNull("context"); mTypeService = context.GetService <ITypeService>(); // Initialize the input. mInput = mTypeService.CreateAny(PortTypes.Any, "Input"); mInput.ValueSet += updateOutputValues; // Initialize the output count. mOutputCount = mTypeService.CreateInt(PortTypes.Integer, "OutputCount", 2); mOutputCount.MinValue = 1; // for use as Lock-out+ (Sperre+) mOutputCount.MaxValue = 50; // Initialize the input for the index of the output to select. mSelectIndexInput = mTypeService.CreateInt(PortTypes.Integer, "OutputSelectIndex"); mSelectIndexInput.MinValue = -1; // -1 selects no output mSelectIndexInput.MaxValue = mOutputCount.MaxValue; // max selects no output mSelectIndexInput.ValueSet += updateOutputValues; // Initialize the selector for "send-on-select". mSelectAction = mTypeService.CreateEnum("ESelectAction3", "SelectAction3", mSelectActionValues, "ResendCurrent"); // Initialize outputs using a helper function that grows/shrinks the list of outputs // whenever the output count is changed mOutputs = new List <AnyValueObject>(); ListHelpers.ConnectListToCounter(mOutputs, mOutputCount, mTypeService.GetValueObjectCreator(PortTypes.Any, OUTPUT_PREFIX), null); // Initialize outputs using a helper function that grows/shrinks the // list of outputs whenever the output count is changed mPrevOutputs = new List <AnyValueObject>(); ListHelpers.ConnectListToCounter(mPrevOutputs, mOutputCount, mTypeService.GetValueObjectCreator(PortTypes.Any, ""), null, null); // Initialize the value to send upon "de-select". mIdleValueType = mTypeService.CreateEnum("EValueType", "IdleValueType", mValueTypes, "none"); updateIdleValueType(); mIdleValueType.ValueSet += updateIdleValueType; }