Hello @Jassim Al Rahma ,
You could add a new MAUI ContentPage named AnotherPage
firstly, then set different page, please refer to the following code:
if (condition_1)
{
Application.Current.MainPage = new AppShell();
}
else
{
Application.Current.MainPage = new AnotherPage();// or new NavigationPage(new AnotherPage()) if you would like to use NavigationPage, see https://learn.microsoft.com/en-us/dotnet/maui/user-interface/pages/navigationpage
}
And I check another thread you create, the condition_1
is requesting the Android permissions which is an async method. So, you can add a default page, then judge permissions and set different page in the OnAppearing
method.
App.xaml.cs
public App() {
InitializeComponent();
MainPage = new DefaultPage();
}
OnAppearing method in DefaultPage
protected override async void OnAppearing()
{
base.OnAppearing();
if (...){
Application.Current.MainPage = new AppShell();
}
else{
Application.Current.MainPage = new NavigationPage(new MauiAwaitSample.MainPage());
}
}
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.