0
votes

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);
            }
        }
1

1 Answers

1
votes

just reassign MainPage

Application.Current.MainPage = new MenuPage();