public void SetLuaTable(LuaTable table, TreeNodeAdv rootNode) { ExpandedNodesDictionary expanded = SaveExpandedNodes(rootNode); rootLuaTable = table; SetFilter(this.filter, true); RestoreExpandedNodes(rootNode, expanded); }
protected ExpandedNodesDictionary SaveExpandedNodes(TreeNodeAdv rootNode) { ExpandedNodesDictionary expandedObjects = new ExpandedNodesDictionary(rootNode.IsExpanded); foreach (TreeNodeAdv child in rootNode.Children) { LuaVariableItem item = child.Tag as LuaVariableItem; if (item != null && item.LuaValue.Type == LuaVariableType.Table) { expandedObjects[item.LuaKey] = SaveExpandedNodes(child); } } return(expandedObjects); }
protected void RestoreExpandedNodes(TreeNodeAdv rootNode, ExpandedNodesDictionary expanded) { rootNode.IsExpanded = expanded.IsExpanded; foreach (TreeNodeAdv child in rootNode.Children) { LuaVariableItem item = child.Tag as LuaVariableItem; if (item != null) { ExpandedNodesDictionary childExpanded; if (expanded.TryGetValue(item.LuaKey, out childExpanded)) { RestoreExpandedNodes(child, childExpanded); } } } }