Search icon CANCEL
Subscription
0
Cart icon
Your Cart (0 item)
Close icon
You have no products in your basket yet
Arrow left icon
Explore Products
Best Sellers
New Releases
Books
Videos
Audiobooks
Learning Hub
Free Learning
Arrow right icon
Arrow up icon
GO TO TOP
Mastering Xamarin.Forms

You're reading from   Mastering Xamarin.Forms App architecture techniques for building multi-platform, native mobile apps with Xamarin.Forms 4

Arrow left icon
Product type Paperback
Published in Dec 2019
Publisher
ISBN-13 9781839213380
Length 200 pages
Edition 3rd Edition
Tools
Arrow right icon
Author (1):
Arrow left icon
Ed Snider Ed Snider
Author Profile Icon Ed Snider
Ed Snider
Arrow right icon
View More author details
Toc

Adding a sign-in page

In order to add sign-in capabilities to our app, we need to create a new Page and a new ViewModel. The ViewModel will be pretty straightforward, containing just a single command that handles signing into Facebook via the IAuthService interface, and passing the received Facebook token to the Azure backend service through the ITripLogDataService, as shown in the following steps:

  1. Create a new class that inherits from BaseViewModel, named SignInViewModel, in the ViewModels folder in the core library project:
    public class SignInViewModel : BaseViewModel
    {
    }
    
  2. Update the SignInViewModel with a constructor that takes in INavService, IAuthService, and ITripLogDataService parameters:
    public class SignInViewModel : BaseViewModel
    {
        readonly IAuthService _authService;
        readonly ITripLogDataService _tripLogService;
        public SignInViewModel(INavService navService, 
            IAuthService authService, 
            ITripLogDataService tripLogService)
            :base...
lock icon The rest of the chapter is locked
Register for a free Packt account to unlock a world of extra content!
A free Packt account unlocks extra newsletters, articles, discounted offers, and much more. Start advancing your knowledge today.
Unlock this book and the full library FREE for 7 days
Get unlimited access to 7000+ expert-authored eBooks and videos courses covering every tech area you can think of
Renews at $19.99/month. Cancel anytime
Banner background image