//public string HtmlStr; //private Database db = new Database(Database.contectStr); //private HtmlHelp htmlHelp = new HtmlHelp(); public SingleHeroInfo(HeroInfoTable heroInfo) { InitializeComponent(); //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))); //} //else //{ // htmlHelp.DownloadPage(hero.Link, callback); //} fillData(heroInfo); }
public ChuZhuangControl(List<ChuZhuangTable> list,HeroInfoTable singHero) { InitializeComponent(); this.tbl_Title.Text = "英雄出装路线"; if (list != null||list.Count==0) { List<ChuZhuangTable> list1 = list.Where(c => c.Index == 1).ToList(); List<ChuZhuangTable> list2 = list.Where(c => c.Index == 2).ToList(); List<ChuZhuangTable> list3 = list.Where(c => c.Index == 3).ToList(); foreach (ChuZhuangTable item in list1) { Image image = new Image(); image.Width = 60; image.Height = 60; image.Margin = new Thickness(5, 5, 5, 5); image.Source = new BitmapImage() { UriSource = new Uri(item.ItemUri, UriKind.Relative) }; wp_ChuMen.Children.Add(image); } tb1_ChuMenContent.Text = singHero.ChuMen; foreach (ChuZhuangTable item in list2) { Image image = new Image(); image.Width = 60; image.Height = 60; image.Margin = new Thickness(5, 5, 5, 5); image.Source = new BitmapImage() { UriSource = new Uri(item.ItemUri, UriKind.Relative) }; this.wp_ZhongQi.Children.Add(image); } tb1_ZhongQiContent.Text= singHero.ZhongQi;; foreach (ChuZhuangTable item in list3) { Image image = new Image(); image.Width = 60; image.Height = 60; image.Margin = new Thickness(5, 5, 5, 5); image.Source = new BitmapImage() { UriSource = new Uri(item.ItemUri, UriKind.Relative) }; wp_HouQi.Children.Add(image); } // tb1_ChuMenContent.Text = singHero.ChuMen; tb1_HouQiContent.Text = singHero.HuoQi; } else { this.tbl_Title.Text = "没有相关信息,请等待更新....."; } }
private void callback(string htmlStr) { if (htmlStr.Equals("NO")) { MessageBoxResult result = MessageBox.Show("提醒", "检测当前没有网络,请联上网络在重启程序", MessageBoxButton.OK); if (result == MessageBoxResult.OK) { this.Exit(); } } SingleHeroClass singHero = new SingleHeroClass(htmlStr); string gif = singHero.Image; int start = gif.LastIndexOf('/'); int length = gif.Length - start; string name = gif.Substring(start + 1); string name1 = " /Avatars/" + name.Substring(0, name.Length - 4) + ".png"; HeroInfoTable heroInfo = new HeroInfoTable() { AvatarUri = name1, ChineseName = singHero.Chinese, EnglishName = singHero.English, ShortKey = singHero.Kuaijie, JianChen = singHero.Short, Content = singHero.Body, Gank = singHero.Gank, ShuChu = singHero.Shuchu, TuiJin = singHero.Tuijin, FuZhu = singHero.Fuzhu, RouDun = singHero.Roudun, ChangGui = singHero.Changgui, ChuMen = singHero.Chumen, ZhongQi = singHero.Chumen, HuoQi = singHero.Houqi }; db.heroInfoTable.InsertOnSubmit(heroInfo); SingleHeroInfo singleHeroInfo = new SingleHeroInfo(heroInfo); lb_Info.Items.Add(singleHeroInfo); List<JiNengTable> list_JiNengTable = new List<JiNengTable>(); foreach (Jineng item in singHero.list_Jienng) { string gif1 = item.Image; int start1 = gif1.LastIndexOf('/'); int length1 = gif1.Length - start1; string name2 = gif1.Substring(start1 + 1); string name3 = " /JiNengs/" + name2.Substring(0, name2.Length - 4) + ".png"; JiNengTable jiNeng = new JiNengTable() { AvatarUri = name3, Name = item.Name, Intro = item.Intro, Detail = item.Detail, ShortKey = item.Kuaijie, HeroId = id }; list_JiNengTable.Add(jiNeng); db.jinengTable.InsertOnSubmit(jiNeng); } JiNengInfo jiNengInfo = new JiNengInfo(list_JiNengTable); grid_JiNeng.Children.Add(jiNengInfo); dealWithChuZhuang(singHero, heroInfo); waiting.WaitingEnd(); db.SubmitChanges(); }
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); }
private void fillData(HeroInfoTable heroInfo) { tbl_chineseName.Text = heroInfo.ChineseName; tbl_englishName.Text = heroInfo.EnglishName; tbl_JianChen.Text += heroInfo.JianChen; tbl_content.Text = heroInfo.Content; tbl_ShortKey.Text += heroInfo.ShortKey; for (int i = 0; i < heroInfo.Gank; i++) { Image start = new Image { Source = new BitmapImage(new Uri("/Images/xx_liang.jpg", UriKind.Relative)) }; start.Width = 50; start.Height = 50; wp_Grank.Children.Add(start); } for (int i = 0; i <5- heroInfo.Gank; i++) { Image start = new Image { Source = new BitmapImage(new Uri("/Images/xx_an.jpg", UriKind.Relative)) }; start.Width = 50; start.Height = 50; wp_Grank.Children.Add(start); } for (int i = 0; i < heroInfo.ShuChu; i++) { Image start = new Image { Source = new BitmapImage(new Uri("/Images/xx_liang.jpg", UriKind.Relative)) }; start.Width = 50; start.Height = 50; wp_ShuChu.Children.Add(start); } for (int i = 0; i <5-heroInfo.ShuChu; i++) { Image start = new Image { Source = new BitmapImage(new Uri("/Images/xx_an.jpg", UriKind.Relative)) }; start.Width = 50; start.Height = 50; wp_ShuChu.Children.Add(start); } for (int i = 0; i < heroInfo.FuZhu; i++) { Image start = new Image { Source = new BitmapImage(new Uri("/Images/xx_liang.jpg", UriKind.Relative)) }; start.Width = 50; start.Height = 50; wp_FuZhu.Children.Add(start); } for (int i = 0; i <5- heroInfo.FuZhu; i++) { Image start = new Image { Source = new BitmapImage(new Uri("/Images/xx_an.jpg", UriKind.Relative)) }; start.Width = 50; start.Height = 50; wp_FuZhu.Children.Add(start); } for (int i = 0; i < heroInfo.TuiJin; i++) { Image start = new Image { Source = new BitmapImage(new Uri("/Images/xx_liang.jpg", UriKind.Relative)) }; start.Width = 50; start.Height = 50; wp_TuiJin.Children.Add(start); } for (int i = 0; i <5- heroInfo.TuiJin; i++) { Image start = new Image { Source = new BitmapImage(new Uri("/Images/xx_an.jpg", UriKind.Relative)) }; start.Width = 50; start.Height = 50; wp_TuiJin.Children.Add(start); } for (int i = 0; i < heroInfo.RouDun; i++) { Image start = new Image { Source = new BitmapImage(new Uri("/Images/xx_liang.jpg", UriKind.Relative)) }; start.Width = 50; start.Height = 50; wp_RuoDun.Children.Add(start); } for (int i = 0; i <5- heroInfo.RouDun; i++) { Image start = new Image { Source = new BitmapImage(new Uri("/Images/xx_an.jpg", UriKind.Relative)) }; start.Width = 50; start.Height = 50; wp_RuoDun.Children.Add(start); } //ImageTools.IO.Decoders.AddDecoder<GifDecoder>(); //ImageTools.ExtendedImage image = new ImageTools.ExtendedImage(); //image.UriSource = new Uri(heroInfo.AvatarUri); //Avatar.Source = image; Avatar.Source = new BitmapImage(new Uri(heroInfo.AvatarUri, UriKind.Relative)); }