Exemplo n.º 1
0
        private void NavigationViewControl_ItemInvoked(NavigationView sender, NavigationViewItemInvokedEventArgs args)
        {
            if (args.IsSettingsInvoked == true)
            {
            }
            else if (args.InvokedItem != null)
            {
                var navItemTag = args.InvokedItem.ToString();

                for (var k = 0; k < contentPages.Count; k++)
                {
                    contentPages.ElementAt(k).Value.Visibility = Visibility.Collapsed;
                }

                if (contentPages.ContainsKey(navItemTag))
                {
                    contentPages[navItemTag].Visibility = Visibility.Visible;
                }
                else
                {
                    Page newPage = null;

                    switch (navItemTag)
                    {
                    case "Pet selection":
                        newPage = new PetSelectionPage();
                        ((PetSelectionPage)(newPage)).SetMainPage(this);
                        break;

                    case "Pet options":
                        newPage = new PetOptionsPage();
                        break;

                    case "Pet info":
                        newPage = new PetAboutPage();
                        break;

                    case "Application settings":
                        newPage = new AppOptionsPage();
                        break;

                    case "About":
                        newPage = new AboutPage();
                        break;

                    case "Help":
                        newPage = new HelpPage();
                        break;
                    }

                    if (newPage != null)
                    {
                        myContent.Children.Add(newPage);

                        contentPages.Add(navItemTag, newPage);
                    }
                }
            }
        }
Exemplo n.º 2
0
 protected override void OnNavigatedTo(NavigationEventArgs e)
 {
     base.OnNavigatedTo(e);
     if (e.Parameter.ToString() == "options")
     {
         Page newPage = new PetOptionsPage();
         myContent.Children.Add(newPage);
         contentPages.Add("Pet options", newPage);
     }
     else if (e.Parameter.ToString() == "help")
     {
         Page newPage = new HelpPage();
         myContent.Children.Add(newPage);
         contentPages.Add("Help", newPage);
     }
     else if (e.Parameter.ToString() == "about")
     {
         Page newPage = new PetAboutPage();
         myContent.Children.Add(newPage);
         contentPages.Add("Pet info", newPage);
     }
 }