/// <summary> /// By default, we are configured to use MEF /// </summary> protected override void Configure() { //1. First init catalog for start up. var catalog = new AggregateCatalog( AssemblySource.Instance.Select(x => new AssemblyCatalog(x)).OfType <ComposablePartCatalog>() ); catalog.Catalogs.Add(CreateDirectoryCatalog(Environment.CurrentDirectory + "/Presentation")); catalog.Catalogs.Add(CreateDirectoryCatalog(Environment.CurrentDirectory + "/Workbench")); container = new CompositionContainer(catalog); var batch = new CompositionBatch(); //2. Inject export values to IoC container and resolve their dependencies if needed. var windowManager = new YoZuoWindowManager(); var presentationService = new PresentationService(); var resourceService = new ResourceService(); batch.AddExportedValue <IEventAggregator>(new EventAggregator()); batch.AddExportedValue <IResourceService>(resourceService); batch.AddExportedValue <IWindowManager>(windowManager); batch.AddExportedValue <IYoZuoWindowManager>(windowManager); batch.AddExportedValue <IPresentationService>(presentationService); batch.AddExportedValue(container); batch.AddExportedValue(catalog); container.Compose(batch); container.ComposeParts(resourceService); container.ComposeParts(presentationService); //3. Init the startup environment : Presentation -> Ribbon ; Language -> Chinese presentationService.ChangePresentation("PART_OPTION_PRESENTATION_RIBBON"); resourceService.ChangeLanguage("zh-cn"); }