public async Task SetMainPageAsync(string page, Dictionary <string, object> parameters) { if (string.IsNullOrEmpty(page)) { throw new ArgumentException("You must pass a page to set the main page."); } if (PageNavigation.Navigation != null) { HandleDeInitializations(GetCurrentViewModel(), parameters); } var createdPage = PageFactory.CreatePage(page, false); switch (createdPage) { case MasterDetailPage masterDetailPage: await SetMasterDetailPage(parameters, masterDetailPage); break; case TabbedPage tabbedPage: await SetTabbedPage(parameters, tabbedPage); break; default: var navPage = PageFactory.GetNavigationPage(createdPage); Application.Current.MainPage = navPage; await HandleInitializations(createdPage.BindingContext, parameters); break; } }