Beispiel #1
0
        public WBSTreeVirtualizerUtil(IEnumerable <T> actionList)
        {
            // _list.AddRange(actionList);
            var splittedActions = actionList.Select(_ => new { splittedWBS = WBSWebActionUtil <T> .GetParts(_.WBS), action = _ }).ToArray();

            var treeRoot = splittedActions.Where(splittedAction => splittedAction.splittedWBS.Length == 1)
                           .Select(splittedAction => CreateRecursively(splittedAction.action, actionList))
                           .OrderBy(_ => _.Action.WBSParts[0])
                           .ToList();

            _actionTree = treeRoot;
        }
Beispiel #2
0
        private Node CreateRecursively(T action, IEnumerable <T> actions)
        {
            var wrappedAction = new Node(action);

            wrappedAction.Children = new List <Node>();
            if (WBSWebActionUtil <T> .HasChildren(action, actions))
            {
                wrappedAction.Children = WBSWebActionUtil <T> .GetChildren(action, actions)
                                         .Select(_ => CreateRecursively(_, actions))
                                         .OrderBy(_ => _.Action.WBSParts[WBSWebActionUtil <T> .IndentationFromWBS(_.Action.WBS)])
                                         .ToList();
            }

            return(wrappedAction);
        }