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);
}
}
只需重新分配MainPage
Application.Current.MainPage = new MenuPage();
The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.