private void FillVarList(string description, ItemSetRole role) { varTree.Nodes.Add(description, description); foreach (var page in Program.Test.Pages) { foreach (var ctrl in page.Controls) { if (ctrl.GetType() == typeof(ItemSet)) { var itemSet = (ItemSet)ctrl; if (itemSet.Role == role) { varTree.Nodes[description].Nodes.Add(itemSet.Name, itemSet.Name); inputVariables.Add(itemSet.Name); for (int i = 0; i < itemSet.Items.Count; i++) { // Lowest 2 levels not by name but by number ==> arrays (0-based to comform with Python) string itemName = itemSet.Name + "[" + i + "]"; varTree.Nodes[description].Nodes[itemSet.Name].Nodes.Add(itemName, itemName); varTree.Nodes[description].Nodes[itemSet.Name].Nodes[itemName].ToolTipText = itemSet.Items[i].Name; for (int j = 0; j < itemSet.Items[i].Weights.Length; j++) { string altName = itemName + "[" + j + "]"; varTree.Nodes[description].Nodes[itemSet.Name].Nodes[itemName].Nodes.Add(altName, altName); varTree.Nodes[description].Nodes[itemSet.Name].Nodes[itemName].Nodes[altName].ToolTipText = itemSet.Alternatives[j]; } } } } } } }
public ItemCollection(ItemSet itemSet) { Name = itemSet.Name; Role = itemSet.Role; ItemSet = itemSet; for (int j = 0; j < itemSet.Items.Count; j++) { Items.Add(itemSet.Items[j].Copy()); } for (int j = 0; j < itemSet.Alternatives.Count; j++) { Alternatives.Add(itemSet.Alternatives[j]); } }