Hello @Jerry Lipan ,
I'm not very clear about what the appropriate value
means, you could use Xamarin.Essentials: Preferences to store the value and check if user is logged when the app starts. If the user is logged, go to new AppShell()
, else go to new LoginPage()
. I store a bool value, refer to the following code:
Boolean isLogin = Preferences.Get("isLogin", false);
if (isLogin)
{
MainPage = new AppShell();
Shell.Current.GoToAsync("//ItemsPage"); //go to AppShell with Default Page(ItemsPage), you also could go to other pages
}
else
{
MainPage = new LoginPage();
}
When click login:
private void async OnLoginClicked(object obj)
{
Preferences.Set("isLogin", true);
Application.Current.MainPage = new AppShell();
Shell.Current.GoToAsync("//ItemsPage");
}
In addition, there is a closed thread discussing how to do Login, Onboarding, and similar scenarios, you could refer to the solution.
Best Regards,
Wenyan Zhang
If the answer is the right solution, please click "Accept Answer" and kindly upvote it. If you have extra questions about this answer, please click "Comment".
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.