Prism Sample 7 Modules Code
例7对注册Module使用了配置命令。
见app.xaml.cs:
1 using Modules.Views; 2 using Prism.Ioc; 3 using Prism.Modularity; 4 using Prism.Unity; 5 using System.Windows; 6 7 namespace Modules 8 { 9 /// <summary> 10 /// Interaction logic for App.xaml 11 /// </summary> 12 public partial class App : PrismApplication 13 { 14 protected override Window CreateShell() 15 { 16 return Container.Resolve<MainWindow>(); 17 } 18 19 protected override void RegisterTypes(IContainerRegistry containerRegistry) 20 { 21 22 } 23 24 protected override void ConfigureModuleCatalog(IModuleCatalog moduleCatalog) 25 { 26 moduleCatalog.AddModule<ModuleA.ModuleAModule>(); 27 } 28 } 29 }
其中的ConfigureModuleCatalog (catalog目录)用来逐项增加模块。