
上QQ阅读APP看书,第一时间看更新
Making the app run
We can start the app for the first time as follows:
- Open up App.xaml.cs by expanding the App.xaml node in the .NET Standard library.
- Locate the constructor.
- Add a using statement for DoToo.Views and add the following code line in bold:
public App ()
{
InitializeComponent();
MainPage = new NavigationPage(Resolver.Resolve<MainView>());
}
The line added resolves the MainView (and all dependencies, including MainViewModel and the TodoItemRepository) and wraps it into a NavigationPage. The NavigationPage is a page defined in Xamarin.Forms that adds a navigation bar and enables the user to navigate to other views.
That's it! At this point, your project should start. Depending on the platform you are using, it might look like the following screenshot:
