Exemplo n.º 1
0
        private void LoadRelationships(IRegistryQuerier registry)
        {
            if (module.depends == null)
            {
                module.depends = new List <RelationshipDescriptor>();
            }
            if (module.recommends == null)
            {
                module.recommends = new List <RelationshipDescriptor>();
            }
            if (module.suggests == null)
            {
                module.suggests = new List <RelationshipDescriptor>();
            }

            ignored.Clear();
            RelationshipsListView.Items.Clear();
            AddGroup(module.depends, DependsGroup, registry);
            AddGroup(module.recommends, RecommendationsGroup, registry);
            AddGroup(module.suggests, SuggestionsGroup, registry);
            AddGroup(ignored, IgnoredGroup, registry);
            RelationshipsListView.AutoResizeColumns(ColumnHeaderAutoResizeStyle.ColumnContent);

            GroupToRelationships.Clear();
            GroupToRelationships.Add(DependsGroup, module.depends);
            GroupToRelationships.Add(RecommendationsGroup, module.recommends);
            GroupToRelationships.Add(SuggestionsGroup, module.suggests);
            GroupToRelationships.Add(IgnoredGroup, ignored);

            RelationshipsListView_ItemSelectionChanged(null, null);
        }
Exemplo n.º 2
0
        private void LoadRelationships(IRegistryQuerier registry)
        {
            if (module.depends == null)
            {
                module.depends = new List <RelationshipDescriptor>();
            }
            if (module.recommends == null)
            {
                module.recommends = new List <RelationshipDescriptor>();
            }
            if (module.suggests == null)
            {
                module.suggests = new List <RelationshipDescriptor>();
            }

            ignored.Clear();
            // Find installed modules that aren't in the module's relationships
            ignored.AddRange(registry.Installed(false, false)
                             .Where(kvp => {
                var ids = new string[] { kvp.Key };
                return(!module.depends.Any(rel => rel.ContainsAny(ids)) &&
                       !module.recommends.Any(rel => rel.ContainsAny(ids)) &&
                       !module.suggests.Any(rel => rel.ContainsAny(ids)));
            })
                             .Select(kvp => (RelationshipDescriptor) new ModuleRelationshipDescriptor()
            {
                name    = kvp.Key,
                version = kvp.Value,
            })
                             );
            RelationshipsListView.Items.Clear();
            AddGroup(module.depends, DependsGroup, registry);
            AddGroup(module.recommends, RecommendationsGroup, registry);
            AddGroup(module.suggests, SuggestionsGroup, registry);
            AddGroup(ignored, IgnoredGroup, registry);
            RelationshipsListView.AutoResizeColumns(ColumnHeaderAutoResizeStyle.ColumnContent);

            GroupToRelationships.Clear();
            GroupToRelationships.Add(DependsGroup, module.depends);
            GroupToRelationships.Add(RecommendationsGroup, module.recommends);
            GroupToRelationships.Add(SuggestionsGroup, module.suggests);
            GroupToRelationships.Add(IgnoredGroup, ignored);

            RelationshipsListView_ItemSelectionChanged(null, null);
        }