public RegisterGroupItem(XElement regGroup, GroupItem parent, RegViewModel owner) { Element = regGroup; ParentItem = Parent = parent; Owner = owner; Name = regGroup.Attribute("name").Value; Description = regGroup.Attribute("description").Value; ItemPath = Path.Combine(parent.ItemPath, Name); }
public IEnumerable GetChildren(TreePath treePath) { List<BaseItem> items = null; if (treePath.IsEmpty()) { if (cache.ContainsKey("ROOT")) { items = cache["ROOT"]; } else { items = new List<BaseItem>(); cache.Add("ROOT", items); foreach (var group in document.Root.Descendants("group")) { var item = new GroupItem(group, this); items.Add(item); } } } else { var parent = treePath.LastNode as BaseItem; if (parent != null) { if (cache.ContainsKey(parent.ItemPath)) { items = cache[parent.ItemPath]; } else { items = parent.LoadChildren(); cache.Add(parent.ItemPath, items); } } } if (!showDisabled) { return items.Where(item => !item.IsEmpty()); } return items; }