Created
March 3, 2016 04:31
-
-
Save asimmon/b030f8e453af80b1bd10 to your computer and use it in GitHub Desktop.
Sample bootstrapper class for Pillar
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
public class MyAppBootstrapper : PillarBootstrapper | |
{ | |
private readonly Application _app; | |
public MyAppBootstrapper(Application app) | |
{ | |
_app = app; | |
} | |
protected override void ConfigureContainer(ContainerBuilder builder) | |
{ | |
base.ConfigureContainer(builder); | |
builder.RegisterType<FirstViewModel>(); | |
builder.RegisterType<FirstView>(); | |
builder.RegisterType<SecondViewModel>(); | |
builder.RegisterType<SecondView>(); | |
} | |
protected override void RegisterViews(IViewFactory viewFactory) | |
{ | |
viewFactory.Register<FirstViewModel, FirstView>(); | |
viewFactory.Register<SecondViewModel, SecondView>(); | |
} | |
protected override void ConfigureApplication(IContainer container) | |
{ | |
var viewFactory = container.Resolve<IViewFactory>(); | |
var page = viewFactory.Resolve<FirstViewModel>(); | |
_app.MainPage = new NavigationPage(page); | |
} | |
} | |
public class App : Application | |
{ | |
public App() | |
{ | |
new MyAppBootstrapper(this).Run(); | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment