public void Recompose() { AttributedModelServices.ComposeParts(DefaultComposer.Container, this); this.NormalTalents = (from t in this.AllTalents where t.TalentType == TalentType.Normal select t).ToList(); this.RacialTalents = (from t in this.AllTalents where t.TalentType == TalentType.Racial select t).ToList(); }
public void InitiailizeComposition(ShellApplication application) { var aggregateCatalog = new AggregateCatalog(); // Directory catalog. aggregateCatalog.Catalogs.Add(new DirectoryCatalog(new DirectoryInfo(typeof(ShellApplication).Assembly.Location).Parent.FullName)); _compositionContainer = new CompositionContainer(aggregateCatalog); AttributedModelServices.ComposeParts(_compositionContainer, application); }
private void BaseLoadPlugin() { var path = Path.Combine(AppDomain.CurrentDomain.BaseDirectory, "Plugins"); var pattern = "*.dll"; DirectoryCatalog directoryCatalog = new DirectoryCatalog(path, pattern); if (!Directory.Exists(path)) { Directory.CreateDirectory(path); } AttributedModelServices.ComposeParts(new CompositionContainer(directoryCatalog), this); OnPluginComposed(); _loaded = true; }
/// <summary> /// Init the composition container, and fill our internal lists. /// </summary> private void Init() { // We need to do this only once. if (_container != null) { return; } // Catalog with this assembly and anything else in the same directory var catalog = new AggregateCatalog(); catalog.Catalogs.Add(new DirectoryCatalog(Path.GetDirectoryName(typeof(ExtensibilityControl).Assembly.Location))); // And attach the container to the catalog, and run the composition. _container = new CompositionContainer(catalog); AttributedModelServices.ComposeParts(_container, this); }
public void Compose() { this.ClearCompositionExceptions(); if (!this.containsNonInternalParts && this.assemblies.Count <= 0 && this.folders.Count <= 0) { return; } List <ComposablePartCatalog> list = new List <ComposablePartCatalog>(); foreach (string codeBase in this.assemblies) { try { list.Add((ComposablePartCatalog) new AssemblyCatalog(codeBase)); } catch (Exception ex) { throw; } } foreach (string path in this.folders) { try { if (Microsoft.Expression.Framework.Documents.PathHelper.DirectoryExists(path)) { if (Directory.GetFiles(path).Length > 0) { list.Add((ComposablePartCatalog) new DirectoryCatalog(path, ExpressionMefHostingService.ExtensionSearchPattern)); } } } catch (Exception ex) { throw; } } if (list.Count <= 0 && !this.containsNonInternalParts) { return; } CompositionContainer container = new CompositionContainer((ComposablePartCatalog) new AggregateCatalog((IEnumerable <ComposablePartCatalog>)list), new ExportProvider[0]); try { AttributedModelServices.ComposeParts(container, this.parts.ToArray()); } catch (Exception ex) { throw; } foreach (IPackage package in this.Packages) { try { package.Load(this.services); } catch (Exception ex) { this.AddCompositionException(ex); } } }