示例#1
0
        public ProjectionFrame MakeFrame(Guid id, int maxDepth, Dictionary <string, object> parameters)
        {
            if (parameters.ContainsKey(_rootElement.Name))
            {
                parameters[_rootElement.Name] = id;
            }
            else
            {
                parameters.Add(_rootElement.Name, id);
            }
            var root = new FrameNode(id, _rootElement, 1, parameters);
            IEnumerable <FrameNodeGroup> currentLevel = new[]
            {
                new FrameNodeGroup(_rootElement,
                                   new[] { root },
                                   new ParameterNames(parameters.Select(k => k.Key)))
            };

            if (maxDepth > 1 || maxDepth == -1)
            {
                while (currentLevel.Any())
                {
                    currentLevel = _commendations.GetNewGroups(currentLevel);
                    currentLevel = FilterByDepth(currentLevel, maxDepth);
                    currentLevel = FilterByCount(currentLevel);
                }
            }
            else
            {
                root.ChildNodes = new FrameNode[0];
            }
            foreach (var storage in _storages)
            {
                storage.Clear();
            }
            return(new ProjectionFrame(root));
        }
示例#2
0
 public ProjectionFrame(FrameNode rootNode)
 {
     RootNode = rootNode;
 }