コード例 #1
0
        public WBSTreeVirtualizer(IEnumerable <KAction> actionList)
        {
            // _list.AddRange(actionList);
            var splittedActions = actionList.Select(_ => new { splittedWBS = WBSHelper.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;
        }
コード例 #2
0
        private Node CreateRecursively(KAction action, IEnumerable <KAction> actions)
        {
            var wrappedAction = new Node(action);

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

            return(wrappedAction);
        }