private void LoadBranch(ScenarioNode scenarioNode, TreeNode parent) { if (parent == null) // root { parent = new TreeNode { Text = scenarioNode.Name, Tag = scenarioNode, NodeFont = new Font("Tahoma", 8, FontStyle.Bold), }; treeScenario.Nodes.Add(parent); } foreach (ScenarioNode node in scenarioNode.GetChildren()) { var n = new TreeNode { Text = node.Name, Tag = node, }; parent.Nodes.Add(n); LoadBranch(node, n); } }
private void MergeNodes(ScenarioNode source, ScenarioNode dest) { foreach (ScenarioNode child in source.GetChildren()) { var @new = dest.AddChild(child.Name, new Guid(child.Model.Name.Replace('_','-'))); foreach (var declaration in child.SourceValueDeclarations) { var newDeclaration = @new.AddSourceValueDeclaration(declaration.Type, new Guid(declaration.Model.Name.Replace('_', '-'))); newDeclaration.Name = declaration.Name; newDeclaration.Comment = declaration.Comment; newDeclaration.DefaultValue = declaration.DefaultValue; newDeclaration.MeasurementUnit = declaration.MeasurementUnit; //newDeclaration.RepositoryValuePath = declaration.RepositoryValuePath; newDeclaration.ValueForTesting = declaration.ValueForTesting; } foreach (var declaration in child.FormulaDeclarations) { var newDeclaration = @new.AddFormulaDeclaration(declaration.Type, new Guid(declaration.Model.Name.Replace('_', '-'))); newDeclaration.Name = declaration.Name; newDeclaration.ElfCode = declaration.ElfCode; newDeclaration.HumanText = declaration.HumanText; } foreach (var declaration in child.ConditionDeclarations) { var newDeclaration = @new.AddConditionDeclaration(); newDeclaration.Name = declaration.Name; newDeclaration.Handler = declaration.Handler; newDeclaration.Model = declaration.Model; } @new.NodeType = child.NodeType; @new.IsAppendix = child.IsAppendix; @new.SortingWeight = child.SortingWeight; @new.Template = child.Template; @new.Title = child.Title; MergeNodes(child, @new); } }