示例#1
0
        private void InitializeFilter()
        {
            Filter.SolutionFilter = AllSolutions.FirstOrDefault();
            Filter.AnalyzeProjectsAndSolutions(AllProjects, AllSolutions);

            UsedProjectReferences.Initialize(AllProjects
                                             .SelectMany(p => p.ProjectReferences)
                                             .DistinctBy(p => p.Path)
                                             .OrderBy(p => p.Name));

            Filter.ProjectReferenceFilter = UsedProjectReferences.FirstOrDefault();

            UsedNuGetPackages.Initialize(AllProjects
                                         .SelectMany(p => p.NuGetReferences)
                                         .DistinctBy(n => n.Name + "-" + n.Version)
                                         .OrderByThenBy(p => p.Name, p => VersionUtilities.FromString(p.Version)));

            UsedNuGetPackageNames.Initialize(UsedNuGetPackages
                                             .OrderByThenBy(p => p.Name, p => p.Version)
                                             .GroupBy(p => p.Name)
                                             .Select(g => new NuGetPackageVersionGroup
            {
                Name     = g.Key,
                Versions = g.Count() == 1 ? g.First().Version : g.First().Version + " - " + g.Last().Version
            }));

            Filter.NuGetPackageFilter     = UsedNuGetPackages.FirstOrDefault();
            Filter.NuGetPackageNameFilter = UsedNuGetPackageNames.FirstOrDefault();
        }
示例#2
0
        private async Task SetProjectReferenceFilterAsync(VsObject project)
        {
            ClearFilter();

            var selectedProjectReference = project is VsProject?
                                           UsedProjectReferences.FirstOrDefault(p => p.IsSameProject((VsProject)project)) :
                                               UsedProjectReferences.FirstOrDefault(p => p.IsSameProject((VsProjectReference)project));

            if (selectedProjectReference != null)
            {
                Filter.ProjectReferenceFilter          = selectedProjectReference;
                Filter.IsProjectReferenceFilterEnabled = true;
            }
            else
            {
                await Messenger.Default.SendAsync(new TextMessage("The project is not referenced in any project. ", "Project not referenced"));
            }
        }