Ejemplo n.º 1
0
        private void Navigate()
        {
            App.Master.IsPresented = false;
            var currentPageTitle = App.Master.Detail.Title;

            if (this.PageName != currentPageTitle)
            {
                if (this.PageName == "LoginPage")
                {
                    Settings.IsRemembered = "false";
                    var mainViewModel = MainViewModel.GetInstance();
                    mainViewModel.Token          = null;
                    mainViewModel.User           = null;
                    Application.Current.MainPage = new NavigationPage(
                        new LoginPage());
                }
                else if (this.PageName == "Home")
                {
                    LandingTabbedPage page = new LandingTabbedPage();
                    (App.Current.MainPage as MasterDetailPage).Detail.Navigation.PushAsync(page);
                }
                else if (this.PageName == "MyProfilePage")
                {
                    MainViewModel.GetInstance().MyProfile = new MyProfileViewModel();
                    (App.Current.MainPage as MasterDetailPage).Detail.Navigation.PushAsync(new MyProfilePage());
                }
                else if (this.PageName == "AboutPage")
                {
                    (App.Current.MainPage as MasterDetailPage).Detail.Navigation.PushAsync(new AboutPage());
                }
            }
        }
 protected override void OnElementChanged(ElementChangedEventArgs <TabbedPage> e)
 {
     base.OnElementChanged(e);
     if (e.NewElement != null)
     {
         _page = (LandingTabbedPage)e.NewElement;
     }
     else
     {
         _page = (LandingTabbedPage)e.OldElement;
     }
 }