public ReferenceInfo(Dictionary <ComponentWrapper, ReferenceData> references, ProjectWrapper Project, SolutionWrapper Solution, OnAddComponentHandler OnAddComponent) { this.ReadOnlyComponents = new List <ComponentWrapper>(); this.Project = Project; this.Solution = Solution; this.OnAddComponent = OnAddComponent; this.AddedComponents = new Collection <ComponentWrapper>(); this.RemovedComponents = new Collection <ComponentWrapper>(); if (references != null) { this.References = references; } else { this.References = new Dictionary <ComponentWrapper, ReferenceData>(); foreach (BaseWrapper wrapper in GetComponents()) { ComponentWrapper component = ComponentWrapper.GetComponentWrapper(wrapper); References.Add(component, new ReferenceData(wrapper)); } foreach (ComponentWrapper component in this.References.Keys) { BaseWrapper wrapper = this[component].Wrapper; switch (component.ComponentType) { case ComponentTypeWrapper.Library: LibraryWrapper library = wrapper as LibraryWrapper; Debug.Assert(library != null); library.Dependencies = GetComponents(library.Dependencies); if ((library.LibraryCategory != null) && (library.HasLibraryCategory)) { library.LibraryCategory = GetComponent(library.LibraryCategory); } break; case ComponentTypeWrapper.Feature: FeatureWrapper feature = wrapper as FeatureWrapper; Debug.Assert(feature != null); feature.FeatureDependencies = GetComponents(feature.FeatureDependencies); feature.ComponentDependencies = GetComponents(feature.ComponentDependencies); break; case ComponentTypeWrapper.LibraryCategory: LibraryCategoryWrapper libcat = wrapper as LibraryCategoryWrapper; Debug.Assert(libcat != null); libcat.FeatureAssociations = GetComponents(libcat.FeatureAssociations); break; default: Debug.Assert(false); break; } } this.Solution.TransportType.FeatureAssociations = GetComponents(this.Solution.TransportType.FeatureAssociations); } }
protected override void CheckComponents() { if (this.FeaturesInfo != null) { foreach (ComponentWrapper feature in this.FeaturesInfo.CheckedComponents) { feature.Checked = true; } } foreach (LibraryWrapper template in this.Templates) { ComponentWrapper component = ComponentWrapper.GetComponentWrapper(template); this.References.Add(component, new ReferenceData(template)); MutualReference(template.LibraryCategory, component, ReferenceType.Realization); } foreach (ComponentWrapper component in this.References.Keys) { ReferenceData refData = this[component]; bool add = component.Checked; switch (component.ComponentType) { case ComponentTypeWrapper.LibraryCategory: LibraryCategoryWrapper libcat = refData.Wrapper as LibraryCategoryWrapper; Debug.Assert(libcat != null); if ((libcat.Required == true) || (this.IsTransport(libcat))) { add = true; } break; case ComponentTypeWrapper.Library: LibraryWrapper library = refData.Wrapper as LibraryWrapper; if (library.IsTemplate) { component.Name = "Generate Template"; } Debug.Assert(library != null); if (library.Required == true) { component.Checked = true; add = true; } break; case ComponentTypeWrapper.Feature: FeatureWrapper feature = refData.Wrapper as FeatureWrapper; Debug.Assert(feature != null); if (feature.Required == true) { component.Checked = true; add = true; } break; default: Debug.Assert(false); break; } if (add) { RecursiveAddComponent(component); } } foreach (ComponentWrapper component in this.References.Keys) { if (DefaultComponents(component, this)) { this.ReadOnlyComponents.Add(component); } break; } }