protected void childrenInit(AppViewModel appViewModel, XmlNode classDefinition , string parentXPath, XmlNode configNode = null) { ConfigNodeViewModel childNode; XmlNode forkNode; if (classDefinition != null) { foreach (XmlNode child in classDefinition.ChildNodes) { forkNode = getForkChild(child.Attributes[XMLConfig.nameAttribute].Value, configNode); if (forkNode != null) { children.Add(new ForkedNodeViewModel(appViewModel, this, child, forkNode)); } else { childNode = ConfigNodeViewModel.getInstance(appViewModel, this, child , parentXPath, configNode); if (childNode != null) { children.Add(childNode); } } } } }
//constructor called when loading a fork from a .badger file public ForkValueViewModel(AppViewModel appViewModel, XmlNode classDefinition , ConfigNodeViewModel parentNode, XmlNode configNode) { name = configNode.Attributes[XMLConfig.nameAttribute].Value; //not sure how to do this in a more elegant way this.configNode = ConfigNodeViewModel.getInstance(appViewModel, parentNode , classDefinition, parentNode.xPath, configNode); this.configNode.bCanBeForked = false; //already belongs to a fork }
public void init(string appDefinitionFileName, XmlNode configRootNode, string experimentName) { XmlDocument appDefinition = new XmlDocument(); appDefinition.Load(appDefinitionFileName); foreach (XmlNode rootChild in appDefinition.ChildNodes) { if (rootChild.Name == XMLConfig.appNodeTag) { //APP node m_preFiles.Clear(); m_appName = rootChild.Attributes[XMLConfig.nameAttribute].Value; name = experimentName; if (rootChild.Attributes.GetNamedItem(XMLConfig.versionAttribute) != null) { m_version = rootChild.Attributes[XMLConfig.versionAttribute].Value; } else { CaliburnUtility.showWarningDialog("Error reading version attribute: " + XMLConfig.experimentConfigVersion , "ERROR"); m_version = "0.0.0.0"; } foreach (XmlNode child in rootChild.ChildNodes) { //Only EXE, PRE, INCLUDE and BRANCH children nodes if (child.Name == XMLConfig.exeNodeTag) { m_exeFile = child.InnerText; } else if (child.Name == XMLConfig.preNodeTag) { m_preFiles.Add(child.InnerText); } else if (child.Name == XMLConfig.includeNodeTag) { loadIncludedDefinitionFile(child.InnerText); } else { children.Add(ConfigNodeViewModel.getInstance(this, null, child, m_appName, configRootNode)); //here we assume definitions are before the children } } } } //deferred load step: enumerated types doDeferredLoadSteps(); }
public void Initialize(string appDefinitionFileName, XmlNode configRootNode, string experimentName) { //Create wires m_wiresViewModel = new WiresViewModel(this); XmlDocument appDefinition = new XmlDocument(); appDefinition.Load(appDefinitionFileName); foreach (XmlNode rootChild in appDefinition.ChildNodes) { if (rootChild.Name == XMLTags.AppNodeTag) { //APP node m_appName = rootChild.Attributes[XMLTags.nameAttribute].Value; Name = experimentName; if (rootChild.Attributes.GetNamedItem(XMLTags.versionAttribute) != null) { m_version = rootChild.Attributes[XMLTags.versionAttribute].Value; } else { CaliburnUtility.ShowWarningDialog("Error reading version attribute: " + XMLTags.ExperimentConfigVersion, "ERROR"); m_version = "0.0.0.0"; } foreach (XmlNode child in rootChild.ChildNodes) { if (child.Name == Herd.Network.XmlTags.Version) { m_appVersions.Add(new AppVersion(child)); } else if (child.Name == Herd.Network.XmlTags.Include) { LoadIncludedDefinitionFile(child.InnerText); } else { // here we expect definitions before any children that uses them children.Add(ConfigNodeViewModel.getInstance(this, null, child, m_appName, configRootNode)); } } } } LinkNodes(); //deferred load step: enumerated types DoDeferredLoadSteps(); }