|
| 1 | +using Microsoft.Practices.Unity; |
| 2 | +using Prism.Modularity; |
| 3 | +using Prism.Unity; |
| 4 | +using PrismUnityDemo.Data; |
| 5 | +using PrismUnityDemo.Modules; |
| 6 | +using PrismUnityDemo.ViewModel; |
| 7 | +using PrismUnityDemo.Contracts; |
| 8 | +using PrismUnityDemo.Views; |
| 9 | +using System.Windows; |
| 10 | + |
| 11 | +namespace PrismUnityDemo |
| 12 | +{ |
| 13 | + class Bootstrapper : UnityBootstrapper |
| 14 | + { |
| 15 | + protected override DependencyObject CreateShell() |
| 16 | + { |
| 17 | + return Container.Resolve<MainWindow>(); |
| 18 | + } |
| 19 | + |
| 20 | + protected override void ConfigureContainer() |
| 21 | + { |
| 22 | + base.ConfigureContainer(); |
| 23 | + |
| 24 | + this.Container.RegisterType<MainWindowNavigationController>( |
| 25 | + new ContainerControlledLifetimeManager()); |
| 26 | + this.Container.RegisterType(typeof(ProductMaintenanceViewModel)); |
| 27 | + this.Container.RegisterTypeForNavigation<ProductDetailView>(nameof(ProductDetailView)); |
| 28 | + this.Container.RegisterType(typeof(ProductDetailViewModel)); |
| 29 | + this.Container.RegisterType<GlobalCommands>(new ContainerControlledLifetimeManager()); |
| 30 | + } |
| 31 | + |
| 32 | + protected override void ConfigureModuleCatalog() |
| 33 | + { |
| 34 | + this.ModuleCatalog.AddModule(new ModuleInfo |
| 35 | + { |
| 36 | + ModuleName = "Repository", |
| 37 | + ModuleType = typeof(RepositoryModule).AssemblyQualifiedName |
| 38 | + }); |
| 39 | + this.ModuleCatalog.AddModule(new ModuleInfo |
| 40 | + { |
| 41 | + ModuleName = "Product Maintenance", |
| 42 | + ModuleType = typeof(ProductMaintenanceModule).AssemblyQualifiedName |
| 43 | + }); |
| 44 | + } |
| 45 | + |
| 46 | + protected override void InitializeShell() |
| 47 | + { |
| 48 | + Application.Current.MainWindow.Show(); |
| 49 | + } |
| 50 | + } |
| 51 | +} |
0 commit comments