Exemple #1
0
 private void AddPageToNav(string title, Page page, string navCategory)
 {
     //add an entry for this page to the list of NavItems.
     if (navCategory == null)
     {
         return;
     }
     if (navCategory == "")
     {
         NavItems.Add(new NavItem(title, page));
     }
     else
     {
         NavItem category = null;
         foreach (NavItem i in NavItems)
         {
             if (i.title == navCategory)                     //if there already exists an item for that category
             {
                 category = i;
                 break;
             }
         }
         if (category == null)                 //if the category does not exist yet, create it
         {
             category = new NavItem(navCategory, null);
             NavItems.Add(category);
         }
         category.children.Add(new NavItem(title, page));
     }
 }
 public MainViewModel()
 {
     NavItems.Add(new NavItem {
         Name = "主页", PageFullName = typeof(HomePage).FullName
     });
     NavItems.Add(new NavItem {
         Name = "鱼类", PageFullName = typeof(FishPage).FullName
     });
     NavItems.Add(new NavItem {
         Name = "昆虫", PageFullName = typeof(InsectPage).FullName
     });
     NavItems.Add(new NavItem {
         Name = "价格预测", PageFullName = typeof(PricePage).FullName
     });
 }
 public MainViewModel()
 {
     NavItems.Add(new NavItem {
         Name = "主页", PageFullName = typeof(HomePage).FullName
     });
     NavItems.Add(new NavItem {
         Name = "鱼类", PageFullName = typeof(FishPage).FullName
     });
     NavItems.Add(new NavItem {
         Name = "昆虫", PageFullName = typeof(InsectPage).FullName
     });
     //NavItems.Add(new NavItem { Name = "植物", PageFullName = typeof(PlantPage).FullName });
     NavItems.Add(new NavItem {
         Name = "唱片", PageFullName = typeof(AlbumPage).FullName
     });
     NavItems.Add(new NavItem {
         Name = "小动物", PageFullName = typeof(LittleAnimalPage).FullName
     });
     NavItems.Add(new NavItem {
         Name = "大头菜", PageFullName = typeof(PricePage).FullName
     });
 }