public MultiValuedItemConfigViewModel(ExperimentViewModel parentExperiment, MultiValuedConfigViewModel parent , XmlNode definitionNode, string parentXPath, XmlNode configNode = null) { CommonInitialization(parentExperiment, parent, definitionNode, parentXPath); m_parent = parent; m_className = definitionNode.Attributes[XMLTags.classAttribute].Value; switch (m_className) { case XMLTags.integerNodeTag: children.Add(new IntegerValueConfigViewModel(parentExperiment, this, definitionNode, m_xPath, configNode)); break; case XMLTags.boolNodeTag: children.Add(new BoolValueConfigViewModel(parentExperiment, this, definitionNode, m_xPath, configNode)); break; case XMLTags.doubleNodeTag: children.Add(new DoubleValueConfigViewModel(parentExperiment, this, definitionNode, m_xPath, configNode)); break; case XMLTags.stringNodeTag: children.Add(new StringValueConfigViewModel(parentExperiment, this, definitionNode, m_xPath, configNode)); break; case XMLTags.filePathNodeTag: children.Add(new FilePathValueConfigViewModel(parentExperiment, this, definitionNode, m_xPath, configNode)); break; case XMLTags.dirPathNodeTag: children.Add(new DirPathValueConfigViewModel(parentExperiment, this, definitionNode, m_xPath, configNode)); break; case XMLTags.stateVarRefTag: children.Add(new WorldVarRefValueConfigViewModel(parentExperiment, WorldVarType.StateVar, parent, definitionNode, parentXPath, configNode)); break; case XMLTags.actionVarRefTag: children.Add(new WorldVarRefValueConfigViewModel(parentExperiment, WorldVarType.ActionVar, parent, definitionNode, parentXPath, configNode)); break; default: XmlNode classDefinition = parentExperiment.GetClassDefinition(m_className); if (classDefinition != null) { childrenInit(parentExperiment, parentExperiment.GetClassDefinition(m_className), m_xPath, configNode); } break; } }
public ChoiceElementConfigViewModel(ExperimentViewModel parentExperiment, ConfigNodeViewModel parent, XmlNode definitionNode , string parentXPath, XmlNode configNode = null) { CommonInitialization(parentExperiment, parent, definitionNode, parentXPath); m_className = definitionNode.Attributes[XMLTags.classAttribute].Value; if (definitionNode.Attributes.GetNamedItem(XMLTags.windowAttribute) != null) { m_window = definitionNode.Attributes[XMLTags.windowAttribute].Value; } else { m_window = ""; } if (definitionNode.Attributes.GetNamedItem(XMLTags.optionalAttribute) != null) { m_bOptional = definitionNode.Attributes[XMLTags.optionalAttribute].Value == "true"; } else { m_bOptional = false; } if (definitionNode.Attributes.GetNamedItem(XMLTags.badgerMetadataAttribute) != null) { //BadgerMetadata="World=Wind-turbine" string metadata = definitionNode.Attributes[XMLTags.badgerMetadataAttribute].Value; if (metadata.StartsWith("World=")) { m_selectWorld = metadata.Remove(0, "World=".Length); } m_parentExperiment.SelectWorld(m_selectWorld); } if (configNode != null) { configNode = configNode[name]; } //we allow an undefined class ("", most likely) and we just ignore children childrenInit(parentExperiment, parentExperiment.GetClassDefinition(m_className, true) , m_xPath, configNode); }
public BranchConfigViewModel(ExperimentViewModel parentExperiment, ConfigNodeViewModel parent , XmlNode definitionNode, string parentXPath, XmlNode configNode = null, bool initChildren = true) { CommonInitialization(parentExperiment, parent, definitionNode, parentXPath); m_className = definitionNode.Attributes[XMLTags.classAttribute].Value; if (definitionNode.Attributes.GetNamedItem(XMLTags.windowAttribute) != null) { m_window = definitionNode.Attributes[XMLTags.windowAttribute].Value; } else { m_window = ""; } if (definitionNode.Attributes.GetNamedItem(XMLTags.optionalAttribute) != null) { bIsOptional = bool.Parse(definitionNode.Attributes[XMLTags.optionalAttribute].Value); } else { bIsOptional = false; } if (configNode != null) { configNode = configNode[name]; if (configNode != null && bIsOptional) { bIsUsed = true; } } else if (bIsOptional) { bIsUsed = true; } if (initChildren) { childrenInit(parentExperiment, parentExperiment.GetClassDefinition(m_className), m_xPath, configNode); } }