public static NodeDiscreteOutput BuildWith(FieldIdentifier Code, FieldString Address, FieldSignalName OutputName) { //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_OutputNameName), OutputName); //Add Fields here: mutableFields.Add(new FieldIdentifier(m_CodeName), Code); //build children KeyedNodeCollection <NodeBase> mutableChildren = new KeyedNodeCollection <NodeBase>(); mutableChildren.Add(NodeSignalIn.BuildWith( new FieldDataType(FieldDataType.DataTypeEnum.BOOL), new FieldConstant(FieldDataType.DataTypeEnum.BOOL, false))); //Add Children here: mutableChildren.Add(SomeChild); //build node NodeDiscreteOutput Builder = new NodeDiscreteOutput( new ReadOnlyDictionary <FieldIdentifier, FieldBase>(mutableFields), new ReadOnlyCollection <NodeBase>(mutableChildren)); return(Builder); }
public DiscreteOutputItem(ISolutionItem parent, NodeDiscreteOutput discreteOutput) : base(parent, string.Empty) { SetIconFromBitmap(Resources.Images.On); onIcon = Icon; SetIconFromBitmap(Resources.Images.Off); offIcon = Icon; ContextMenu = extensionService.Sort(contextMenu); DiscreteOutput = discreteOutput; runtimeService.ValueChanged += new ValueChangedHandler(runtimeService_ValueChanged); }
public static NodeDiscreteOutput BuildWith(FieldIdentifier Code, FieldString Address, FieldSignalName OutputName) { //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_OutputNameName), OutputName); //Add Fields here: mutableFields.Add(new FieldIdentifier(m_CodeName), Code); //build children KeyedNodeCollection<NodeBase> mutableChildren = new KeyedNodeCollection<NodeBase>(); mutableChildren.Add(NodeSignalIn.BuildWith( new FieldDataType(FieldDataType.DataTypeEnum.BOOL), new FieldConstant(FieldDataType.DataTypeEnum.BOOL, false))); //Add Children here: mutableChildren.Add(SomeChild); //build node NodeDiscreteOutput Builder = new NodeDiscreteOutput( new ReadOnlyDictionary<FieldIdentifier, FieldBase>(mutableFields), new ReadOnlyCollection<NodeBase>(mutableChildren)); return Builder; }