Using the API
With the Client
class and its supporting DTO
and API
domain classes in place, we’re ready to interact with the API to create accounts and log in, as well as store and retrieve our preferences.
Creating the account
The first thing a new user will do is create an account. To make this work, we need to bring the user to the Login page when the app starts. Here, the user can log in, or if they don’t have an account, they can click on Create Account, which will take them to CreateAccount.xaml
, where they can fill in their name, email, and password. To implement this, we have to make some substantial changes to the Login and Create Account pages.
Let’s begin by pointing the application to start with login. Modify the App.xaml.cs
App
method to look like this:
public App(LoginViewModel loginViewModel) [1] { InitializeComponent(); MainPage = new LoginPage(loginViewModel); [2] }
[1]
Have the IoC container pass in an instance...