我的rootpage xamarin表单中的错误

时间:2017-09-25 13:15:49

标签: xamarin

我的Rootpage和控制我所有页面的页面,它在关闭时发出一个未处理的错误,每当一个命令关闭错误时,当我收到推送通知并且我将打开rootpage时,会发生错误秒以后。我的命令下面有问题吗?

public class RootPage : MasterDetailPage
{
    Dictionary<MenuIndex, NavigationPage> Views { get; set; }

    public RootPage()
    {
        Title = "App";

        Views = new Dictionary<MenuIndex, NavigationPage>();

        Master = new MenuPage(this)
        {
            Icon = "ic_menu_white.png"
        };

        NavigateAsync(MenuIndex.Home);
    }

    public void NavigateAsync(MenuIndex id)
    {
        Page newPage;

        if (!Views.ContainsKey(id))
        {
            switch (id)
            {
                case MenuIndex.Home:
                        Views.Add(id, new ControlNavigationApp(new HomePage(), "#04518c"));
                    break;
                case MenuIndex.pag1:

                    Views.Add(id, new ControlNavigationApp(new TabPage1(), "#04518c"));

                    break;
                case MenuIndex.pag2:

                    Views.Add(id, new ControlNavigationApp(new TabPage2(), "#04518c"));

                    break;
                case MenuIndex.pag3:

                    Views.Add(id, new ControlNavigationApp(new TabPage3(), "#04518c"));

                    break;

                case MenuIndex.pag4:
                    Views.Add(id, new ControlNavigationApp(new TabPage4(), "#04518c"));
                    break;

                case MenuIndex.pag5:
                    Views.Add(id, new ControlNavigationApp(new TabPage5(), "#04518c"));
                    break;

                default:
                    break;
            }
        }

        newPage = Views[id];

        if (newPage == null)
            return;

        ////pop to root for Windows Phone
        //if (Detail != null && Device.OS == TargetPlatform.WinPhone)
        //{
        //    await Detail.Navigation.PopToRootAsync();
        //}

        Detail = newPage;

        if (Device.Idiom != TargetIdiom.Tablet)
            IsPresented = false;
    }
}

错误在根页面中,因为我做了一些调用其他页面的测试,并且它们成功地工作了。我在ios中有项目,它完美无缺

Map

0 个答案:

没有答案