-
Notifications
You must be signed in to change notification settings - Fork 0
/
Bootstrapper.cs
48 lines (40 loc) · 1.39 KB
/
Bootstrapper.cs
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
using System;
using System.Reflection;
using System.Windows;
using Microsoft.Practices.Prism.Modularity;
using Microsoft.Practices.Prism.Mvvm;
using Microsoft.Practices.Unity;
using Microsoft.Practices.Prism.UnityExtensions;
namespace Infra
{
public class Bootstrapper : UnityBootstrapper
{
protected override DependencyObject CreateShell()
{
ViewModelLocationProvider.SetDefaultViewModelFactory(type =>
{
var returnType = Container.Resolve(type);
return returnType;
});
var item = Container.Resolve<Shell>();
return item;
}
protected override void InitializeShell()
{
Application.Current.MainWindow = (Window)Shell;
Application.Current.MainWindow.Show();
}
protected override void ConfigureModuleCatalog()
{
string path = @"E:\git\Learn Prism Boostrapper\Prism App\MainModule\bin\Debug\MainModule.dll";
var assembly = Assembly.LoadFrom(path);
var type = assembly.GetType("MainModule.MainModuleModule");
ModuleCatalog.AddModule(new ModuleInfo
{
ModuleName = type.Name,
ModuleType = type.AssemblyQualifiedName,
Ref = new Uri(path, UriKind.RelativeOrAbsolute).AbsoluteUri
});
}
}
}