async void OnLoginButtonClicked(object sender, EventArgs e) { var user = new User { Username = usernameEntry.Text, Password = passwordEntry.Text }; var isValid = viewModel.AreCredentialsCorrect(user); if (isValid) { App.IsUserLoggedIn = true; MessagingCenter.Send <LoginPage>(this, Messages.USER_LOGGED_IN); //App.MainPage = new NavigationPage(new LeftNavPage()); //Navigation.InsertPageBefore(new LeftNavPage(), this); //await Navigation.PopAsync(); } else { messageLabel.Text = "Login failed"; passwordEntry.Text = string.Empty; } }