Hi Forum How come my app crashes after tapping the Log in
Here is my code for log in
`public partial class LoginPage : ContentPage
{
public LoginPage ()
{
InitializeComponent ();
BackgroundColor = Color.FromRgb(51,10,120);
NavigationPage.SetHasNavigationBar(this, false);
}
async void OnLoginButtonClicked(object sender, EventArgs e)
{
var user = new User
{
Username = usernameEntry.Text,
Password = passwordEntry.Text
};
var isValid = AreCredentialsCorrect(user);
if (isValid)
{
App.IsUserLoggedIn = true;
App.Current.MainPage = new MainPage();
//Navigation.InsertPageBefore(new MainPage(), this);
//await Navigation.PopAsync();
}
else
{
messageLabel.Text = "Login failed";
passwordEntry.Text = string.Empty;
}
}
bool AreCredentialsCorrect(User user)
{
return user.Username == Constants.Username && user.Password == Constants.Password;
}
}`