[英]Xamarin.forms - Redirect to anther page without navigation
我正在使用 Xamarin.forms,我有一个 MainPage,它是我的登录页面,有人登录后我想将它们重定向到我的主页,但是当我使用时:
await Application.Current.MainPage.Navigation.PushAsync(new HomePage());
顶部有一个导航,如果没有导航,我将如何做到这一点,完整的方法:
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();
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.