CrhisLit
Different design in maui
Hello friends, I need help, this is my code in .NET MAUI, and I want the application to start if there is a Token saved in SecureStorage, because when starting the application it does not load, that is, the startup code does not reach that line of code that says "Choose()", so you can choose whether to load with the AppShell or the navigation
"Code"
public App()
{
InitializeComponent();
Choose();
}
public async void Choose()
{
string tok = SecureStorage.GetAsync("token").Result;
if (!string.IsNullOrEmpty(tok))
{
MainPage = new NavigationPage(new Home())
{
//FlyoutBackgroundColor = Color.FromHex("#D68900"),
BarBackground = Color.FromArgb("#FFB04B"),
BarTextColor = Color.FromRgb(255, 255, 255),
};
}
else
{
MainPage = new AppShell()
{
FlyoutBackgroundColor = Color.FromArgb("#D68900"),
//BarBackground = Color.FromHex("#FFB04B"),
// BarTextColor = Color.FromRgb(255, 255, 255),
};
}
}
18 replies