private void getCollectionVariable(CollectionVariable collection, TreeNodeCollection nodes) { foreach (TreeNode node in nodes) { if (node.Tag is CollectionVariable) { CollectionVariable variable = new CollectionVariable(node.Text); collection.Add(variable); getCollectionVariable(variable, node.Nodes); } else { collection.Add(node.Tag as VariableBase); } } }
private void GetVariable(CollectionVariable variable, XElement element) { foreach (XElement xElement in element.Elements()) { if (xElement.Name == "Variable") { variable.Add(((Document)Object).Dashboard[xElement.Value]); } else if (xElement.Name == "GroupVariable") { CollectionVariable collection = new CollectionVariable(xElement.Attribute("name").Value); variable.Add(collection); GetVariable(collection, xElement); } } }
/// <summary> /// Добавление в объек колекции переменных /// </summary> /// <param name="name">Название коллекции</param> /// <param name="parentCollection">Владелец коллекции</param> private CollectionVariable AddCollection(string name, CollectionVariable parentCollection, bool isReadOnly = false) { CollectionVariable item = new CollectionVariable(name, isReadOnly); parentCollection.Add(item); return(item); }