Ejemplo n.º 1
0
        public List <LoadChildrenResult> LoadChildrenMultiple(
            RootNodeViewModel projectNode, ICollection <DirectoryNodeViewModel> nodes)
        {
            var tcs = new TaskCompletionSource <List <LoadChildrenResult> >();

            var request = new GetDirectoryEntriesMultipleRequest {
                ProjectPath      = projectNode.GetProjectPath().Value,
                RelativePathList = nodes.Select(x => x.RelativePath).ToList()
            };

            _typedRequestProcessProxy.RunUnbufferedAsync(request,
                                                         response => { LoadChildrenMultipleCallback(tcs, nodes, response); },
                                                         response => { LoadChildrenMultipleErrorCallback(tcs, response); });

            return(tcs.Task.Result);
        }
Ejemplo n.º 2
0
        public IList <LoadChildrenResult> LoadChildrenMultiple(
            RootNodeViewModel projectNode, ICollection <DirectoryNodeViewModel> nodes)
        {
            // "fake" root node does not support loading children dynamically (they should have been set manually)
            if (string.IsNullOrEmpty(projectNode.FullPathString))
            {
                return(ArrayUtilities.EmptyList <LoadChildrenResult> .Instance);
            }


            var tcs = new TaskCompletionSource <List <LoadChildrenResult> >();

            var request = new GetDirectoryEntriesMultipleRequest {
                ProjectPath      = projectNode.GetProjectPath().Value,
                RelativePathList = nodes.Select(x => x.RelativePath).ToList()
            };

            _typedRequestProcessProxy.RunUnbufferedAsync(request, RunAsyncOptions.Default,
                                                         response => { LoadChildrenMultipleCallback(tcs, nodes, response); },
                                                         response => { LoadChildrenMultipleErrorCallback(tcs, response); });

            return(tcs.Task.Result);
        }
Ejemplo n.º 3
0
        private IDictionary <RelativePath, DirectoryEntry> RetrievePreviouslyLoadedChildren(RootNodeViewModel rootNode)
        {
            var result = new Dictionary <RelativePath, DirectoryEntry>();

            // Special case for "fake" empty hierarchy
            if (rootNode.Children.Count > 0)
            {
                var directoryNodes = new List <DirectoryNodeViewModel>();
                CollectChildrenLoadedDirectoryNodes(rootNode, directoryNodes);

                var entries = _nodeViewModelLoader.LoadChildrenMultiple(rootNode, directoryNodes);
                foreach (var entry in entries)
                {
                    result.Add(new RelativePath(entry.Node.RelativePath), entry.Entry);
                }
            }

            return(result);
        }
Ejemplo n.º 4
0
        private uint _maxItemId = 5; // Arbitrary number not too close to 0.

        public VsHierarchyNodes()
        {
            _rootNode        = new RootNodeViewModel();
            _rootNode.ItemId = RootNodeItemId;
            AddNode(_rootNode);
        }