Exemplo n.º 1
0
        private async Task Login(object sender, EventArgs e)
        {
#if __ANDROID__
            user = await _baseViewModel.FindUserByEmailAsync(Constants.FINDUSERBYEMAIL, androidEmailEntry.Text.ToLower(), androidPasswordEntry.Text);
#endif
#if __IOS__
            user = await _baseViewModel.FindUserByEmailAsync(Constants.FINDUSERBYEMAIL, emailEntry.Text.ToLower(), passwordEntry.Text);
#endif
            if (user == null)
            {
                await DisplayAlert("User Not Found", "Wrong Email address or Password, please try again.", "Got It");
            }
            else
            {
                bool UserMatchesPackages = await CheckIfUserMatchesPackages(user);

                //bool UserMatchesPackages = true;
                if (UserMatchesPackages)
                {
                    _baseViewModel.SaveCredentials(user);
                    Application.Current.MainPage = new MainTabbedPage(true);
                }
                else
                {
                    await DisplayAlert("Missing Packages", "Missing packages required to access the content of this account.", "Ok");

                    await Navigation.PopModalAsync();
                }
            }
        }