public Task NavigateTo(NavigationPage page, object dataContext) { ContentPage p; switch (page) { case NavigationPage.Home: p = new HomePage(); break; case NavigationPage.AssemblyTestList: p = new AssemblyTestListPage(); break; case NavigationPage.TestResult: p = new TestResultPage(); break; case NavigationPage.Credits: p = new CreditsPage(); break; default: throw new ArgumentOutOfRangeException(); } p.BindingContext = dataContext; return(navigation.PushAsync(p)); }
public Task NavigateTo(string ViewModelName) { Initialize(); var viewName = ViewModelName.Replace("ViewModel", "View"); var typeInformation = Type.GetType($"{ typeof(CountriesView).Namespace}.{viewName}"); var viewObject = Activator.CreateInstance(typeInformation) as ContentPage; return(_navigation.PushAsync(viewObject)); }