public static NodeDiscreteInput BuildWith(FieldIdentifier Code, FieldString Address, FieldSignalName InputName) { //build fields Dictionary <FieldIdentifier, FieldBase> mutableFields = new Dictionary <FieldIdentifier, FieldBase>(); mutableFields.Add(new FieldIdentifier(m_CodeName), Code); mutableFields.Add(new FieldIdentifier(m_AddressName), Address); mutableFields.Add(new FieldIdentifier(m_ForcedName), new FieldBool(false)); mutableFields.Add(new FieldIdentifier(m_ForcedValueName), new FieldBool(false)); mutableFields.Add(new FieldIdentifier(m_InputNameName), InputName); //Add Fields here: mutableFields.Add(new FieldIdentifier(m_CodeName), Code); //build children KeyedNodeCollection <NodeBase> mutableChildren = new KeyedNodeCollection <NodeBase>(); mutableChildren.Add(NodeSignal.BuildWith( InputName, new FieldDataType(FieldDataType.DataTypeEnum.BOOL), new FieldBool(false), new FieldConstant(FieldDataType.DataTypeEnum.BOOL, false))); //Add Children here: mutableChildren.Add(SomeChild); //build node NodeDiscreteInput Builder = new NodeDiscreteInput( new ReadOnlyDictionary <FieldIdentifier, FieldBase>(mutableFields), new ReadOnlyCollection <NodeBase>(mutableChildren)); return(Builder); }
public DiscreteInputItem(ISolutionItem parent, NodeDiscreteInput discreteInput) : base(parent, string.Empty) { SetIconFromBitmap(Resources.Images.On); onIcon = Icon; SetIconFromBitmap(Resources.Images.Off); offIcon = Icon; ContextMenu = extensionService.Sort(contextMenu); DiscreteInput = discreteInput; runtimeService.ValueChanged += new ValueChangedHandler(runtimeService_ValueChanged); runtimeService.RegisterValueWatcher(this, DiscreteInput.Signal); }
public static NodeDiscreteInput BuildWith(FieldIdentifier Code, FieldString Address, FieldSignalName InputName) { //build fields Dictionary<FieldIdentifier, FieldBase> mutableFields = new Dictionary<FieldIdentifier, FieldBase>(); mutableFields.Add(new FieldIdentifier(m_CodeName), Code); mutableFields.Add(new FieldIdentifier(m_AddressName), Address); mutableFields.Add(new FieldIdentifier(m_ForcedName), new FieldBool(false)); mutableFields.Add(new FieldIdentifier(m_ForcedValueName), new FieldBool(false)); mutableFields.Add(new FieldIdentifier(m_InputNameName), InputName); //Add Fields here: mutableFields.Add(new FieldIdentifier(m_CodeName), Code); //build children KeyedNodeCollection<NodeBase> mutableChildren = new KeyedNodeCollection<NodeBase>(); mutableChildren.Add(NodeSignal.BuildWith( InputName, new FieldDataType(FieldDataType.DataTypeEnum.BOOL), new FieldBool(false), new FieldConstant(FieldDataType.DataTypeEnum.BOOL,false))); //Add Children here: mutableChildren.Add(SomeChild); //build node NodeDiscreteInput Builder = new NodeDiscreteInput( new ReadOnlyDictionary<FieldIdentifier, FieldBase>(mutableFields), new ReadOnlyCollection<NodeBase>(mutableChildren)); return Builder; }