Beispiel #1
0
        private void ToggleTracking(bool track)
        {
            var projects = FilteredProjects
                           .OfType <TrackedProjectViewModel>()
                           .Where(project => project.Track != track);

            foreach (var project in projects)
            {
                project.Track = track;
            }
        }
Beispiel #2
0
        private async Task LoadProjectsAsync()
        {
            ClearLoadedProjects();

            var errors = new Dictionary <string, Exception>();
            var tuple  = await RunTaskAsync(async() =>
            {
                var projectsTask  = VsProject.LoadAllFromDirectoryAsync(RootDirectory, IncludedProjectPathFilter, ExcludedProjectPathFilter, IgnoreExceptions, _projectCollection, errors);
                var solutionsTask = VsSolution.LoadAllFromDirectoryAsync(RootDirectory, IncludedProjectPathFilter, ExcludedProjectPathFilter, IgnoreExceptions, _projectCollection, errors);

                await Task.WhenAll(projectsTask, solutionsTask);
                await Task.Run(() =>
                {
                    var projectCache = projectsTask.Result.ToDictionary(p => p.Path, p => p);
                    foreach (var solution in solutionsTask.Result)
                    {
                        solution.LoadProjects(IgnoreExceptions, projectCache, errors);
                    }
                });

                return(new Tuple <List <VsProject>, List <VsSolution> >(projectsTask.Result, solutionsTask.Result));
            });

            if (tuple != null)
            {
                var projects  = tuple.Item1;
                var solutions = tuple.Item2;

                AllSolutions.Initialize(solutions.OrderBy(p => p.Name));
                AllProjects.Initialize(projects.OrderBy(p => p.Name));

                SelectedProject = FilteredProjects.FirstOrDefault();

                foreach (var error in errors)
                {
                    AddLog(error.Key + "\n" + error.Value.Message);
                }

                InitializeFilter();
                IsLoaded = true;
            }
        }