Reputation: 11961
I am using Xamarin.forms, I have a MainPage which is my login page, after someone logs in I want to redirect them to my home page, but when I user:
await Application.Current.MainPage.Navigation.PushAsync(new HomePage());
There is a navigation at the top, how would I do this without navigation, full method:
public async void OnSubmit(object sender, EventArgs args)
{
UsersClass usersClass = api.loginUser(Username.Text, Password.Text);
if (usersClass.response != null)
{
await DisplayAlert("Error", usersClass.response, "OK");
}
else
{
Application.Current.Properties["username"] = Username.Text;
Application.Current.Properties["isLogin"] = true;
await Application.Current.SavePropertiesAsync();
await Application.Current.MainPage.Navigation.PushAsync(new MenuPage(), true);
}
}
Upvotes: 0
Views: 516
Reputation: 89204
just reassign MainPage
Application.Current.MainPage = new MenuPage();
Upvotes: 1