Hello,
Welcome to our Microsoft Q&A platform!
You need to move the logic of handling navigation to the method OnAppearing .As in the constructor the page has not finished loading yet .
protected override void OnAppearing()
{
base.OnAppearing();
try
{
string login = Application.Current.Properties["islogin"].ToString();
if (login == "true")
{
Navigation.PushAsync(new CarouselHomePage(), true);
}
}
catch (Exception e)
{
Debug.WriteLine("IsLogin::" + e);
}
}
n addition , it should be noted that adding or updating a value in the App.Current.Properties dictionary does not automatically persist it to permanent storage.
So you need to called the method SavePropertiesAsync()
Application.Current.Properties["islogin"] = "true";
Application.Current.SavePropertiesAsync();
Best Regards,
Leon Lu
If the response is helpful, please click "Accept Answer" and upvote it.
Note: Please follow the steps in our documentation to enable e-mail notifications if you want to receive the related email notification for this thread.