Exemplo n.º 1
0
        async Task NavigateToPage(Type pageType)
        {
            Type[]          types = new Type[] { typeof(Command) };
            ConstructorInfo info  = pageType.GetConstructor(types);

            if (info != null)
            {
                Page page = (Xamarin.Forms.Page)Activator.CreateInstance(pageType, new Command(RestoreOriginal));
                if (page is iOSLargeTitlePageCS || page is iOSTranslucentNavigationBarPageCS)
                {
                    page = new iOSNavigationPage(page);
                }
                else if (page is iOSTitleViewPageCS)
                {
                    page = new iOSTitleViewNavigationPage(page);
                }
                else if (page is AndroidTitleViewPageCS)
                {
                    page = new AndroidNavigationPageCS(page);
                }
                SetRoot(page);
            }
            else
            {
                Page page = (Xamarin.Forms.Page)Activator.CreateInstance(pageType);
                if (page is iOSModalPagePresentationStyleCS)
                {
                    await Navigation.PushModalAsync(page);
                }
                else
                {
                    await Navigation.PushAsync(page);
                }
            }
        }
        async Task NavigateToPage(Type pageType)
        {
            Type[]          types = new Type[] { typeof(Command) };
            ConstructorInfo info  = pageType.GetConstructor(types);

            if (info != null)
            {
                Page page = (Page)Activator.CreateInstance(pageType, new Command(RestoreOriginal));
                if (page is iOSLargeTitlePage || page is iOSTranslucentNavigationBarPage)
                {
                    page = new iOSNavigationPage(page);
                }
                SetRoot(page);
            }
            else
            {
                Page page = (Page)Activator.CreateInstance(pageType);
                await Navigation.PushAsync(page);
            }
        }