-
Notifications
You must be signed in to change notification settings - Fork 0
/
Bootstrapper.cs
43 lines (38 loc) · 1.25 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
using MvvmDialogs;
using Prism.Unity;
using Microsoft.Practices.Unity;
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using System.Windows;
using MvvmDialogIssue41.Dialogs;
namespace MvvmDialogIssue41
{
public class Bootstrapper : UnityBootstrapper
{
protected override void InitializeShell()
{
base.InitializeShell();
App.Current.MainWindow = (Window)this.Shell;
App.Current.MainWindow.Show();
var dialogService = Container.Resolve<IDialogService>();
if (dialogService != null)
{
var mainViewModel = ((Window)Shell).DataContext as MainWindowViewModel;
var dialogModel = Container.Resolve<InfoViewModel>();
dialogService.ShowDialog(mainViewModel, dialogModel);
}
}
protected override DependencyObject CreateShell()
{
return Container.TryResolve<MainWindow>();
}
protected override void ConfigureContainer()
{
base.ConfigureContainer();
Container.RegisterInstance<IDialogService>(new DialogService(), new ContainerControlledLifetimeManager());
}
}
}