protected override void OnNavigatedTo(System.Windows.Navigation.NavigationEventArgs e) { base.OnNavigatedTo(e); id = Int32.Parse(NavigationContext.QueryString["id"]); List<HeroTable> list = db.heroTable.ToList(); HeroTable hero = db.heroTable.First(c => c.Id == id); if (db.heroInfoTable.Any(c => c.ChineseName.Equals(hero.Name))) { // fillData(db.heroInfoTable.First(c => c.ChineseName.Equals(hero.Name))); SingleHeroInfo singleHeroInfo = new SingleHeroInfo(db.heroInfoTable.First(c => c.ChineseName.Equals(hero.Name))); lb_Info.Items.Add(singleHeroInfo); List<JiNengTable> list_JiNengTable = new List<JiNengTable>(); list_JiNengTable = db.jinengTable.Where(c => c.HeroId == id).ToList(); JiNengInfo jiNengInfo = new JiNengInfo(list_JiNengTable); grid_JiNeng.Children.Add(jiNengInfo); List<ChuZhuangTable> list_ChuZhuangTable = db.chuZhuangTable.Where(c => c.HeroId == id).ToList(); ChuZhuangControl chuZhongControl = new ChuZhuangControl(list_ChuZhuangTable,db.heroInfoTable.First(c => c.ChineseName.Equals(hero.Name))); grid_ZhuangBei.Children.Add(chuZhongControl); } else { waiting.WaitingBegin(); htmlHelp.DownloadPage(hero.Link, callback); } //JiNengInfo jiNengInfo = new JiNengInfo(id, singleHeroInfo.HtmlStr); // lb_Info.Items.Add(singleHeroInfo); }
private void dealWithChuZhuang(SingleHeroClass singHero,HeroInfoTable heroInfo) { List<ChuZhuangTable> list = new List<ChuZhuangTable>(); if (singHero.HouqiImage != null) { foreach (string s in singHero.ChumenImage) { ChuZhuangTable chuZhuang1 = new ChuZhuangTable(); chuZhuang1.HeroId = id; int start1 = s.LastIndexOf('/'); int length1 = s.Length - start1; string name2 = s.Substring(start1 + 1); string name3 = " /Items/" + name2.Substring(0, name2.Length - 4) + ".png"; chuZhuang1.ItemUri = name3; chuZhuang1.Index = 1; db.chuZhuangTable.InsertOnSubmit(chuZhuang1); list.Add(chuZhuang1); } } if (singHero.ZhongqiImage != null) { foreach (string s in singHero.ZhongqiImage) { ChuZhuangTable chuZhuang1 = new ChuZhuangTable(); chuZhuang1.HeroId = id; int start1 = s.LastIndexOf('/'); int length1 = s.Length - start1; string name2 = s.Substring(start1 + 1); string name3 = " /Items/" + name2.Substring(0, name2.Length - 4) + ".png"; chuZhuang1.ItemUri = name3; chuZhuang1.Index = 2; db.chuZhuangTable.InsertOnSubmit(chuZhuang1); list.Add(chuZhuang1); } } if (singHero.HouqiImage != null) { foreach (string s in singHero.HouqiImage) { ChuZhuangTable chuZhuang1 = new ChuZhuangTable(); chuZhuang1.HeroId = id; int start1 = s.LastIndexOf('/'); int length1 = s.Length - start1; string name2 = s.Substring(start1 + 1); string name3 = " /Items/" + name2.Substring(0, name2.Length - 4) + ".png"; chuZhuang1.ItemUri = name3; chuZhuang1.Index = 3; db.chuZhuangTable.InsertOnSubmit(chuZhuang1); list.Add(chuZhuang1); } } ChuZhuangControl chuZhongControl = new ChuZhuangControl(list, heroInfo); grid_ZhuangBei.Children.Add(chuZhongControl); }