private async void PhoneApplicationPage_Loaded(object sender, RoutedEventArgs e) { string nameSummoner = NavigationContext.QueryString["name"]; SummonerDto summoner = new SummonerDto(); try { summoner = await summoner.SearchSummoner(nameSummoner); textBlockNomeInv.Text = summoner.Nome; } catch { MessageBox.Show("Não existe um invocador com esse nome."); NavigationService.GoBack(); return; } textBlockLevel.Text += summoner.SummonerLevel.ToString(); try { LeagueDto leagueSummoner = new LeagueDto(); leagueSummoner = await leagueSummoner.SearchLeague(summoner.Id); textBlockElo.Text = leagueSummoner.Tier + " " + leagueSummoner.Entries[0].Division; textBlockVit.Text = leagueSummoner.Entries[0].Wins > 1 ? leagueSummoner.Entries[0].Wins.ToString() + " vitórias" : leagueSummoner.Entries[0].Wins.ToString() + " vitória"; textBlockDer.Text = leagueSummoner.Entries[0].Losses > 1 ? leagueSummoner.Entries[0].Losses.ToString() + " derrotas" : leagueSummoner.Entries[0].Losses.ToString() + " derrota"; } catch { MessageBox.Show("Informações de derrotas e vitórias são apenas para jogadores ranqueados.", "Informação", MessageBoxButton.OK); textBlockElo.Text = "Unranked"; textBlockVit.Text = "0 vitória"; textBlockDer.Text = "0 derrota"; } imageInvocador.Source = await summoner.GetProfileIcon(); RecentGamesDto gamesRecent = await new RecentGamesDto().GetLatestGamesById(summoner.Id); List <int> lastChampionsPlayed = new List <int>(); foreach (GameDto game in gamesRecent.Games) { lastChampionsPlayed.Add(game.ChampionId); LastMatches controlMatch = new LastMatches(game); controlMatch.Margin = new Thickness(0, 0, 0, 10); controlMatch.Load(); listboxPartidas.Items.Add(controlMatch); } int idChampPref = lastChampionsPlayed[new Random().Next(lastChampionsPlayed.Count - 1)]; ImageBrush imgBrush = new ImageBrush(); BitmapImage source = (await ChampionDto.SearchChampionAllData(idChampPref)).GetChampionSplash(0); imgBrush.ImageSource = source; imgBrush.Stretch = Stretch.UniformToFill; LayoutRoot.Background = imgBrush; }
private async void PhoneApplicationPage_Loaded(object sender, RoutedEventArgs e) { if (!carregado) { ChampionDto champion = new ChampionDto(); champion = await ChampionDto.SearchChampionAllData(Convert.ToInt32(NavigationContext.QueryString["id"])); iconChampion.Source = await champion.GetChampionSquare(); Random randNumSkin = new Random(); int num = randNumSkin.Next(champion.Skins.Count); BitmapImage backGridInfo = champion.GetChampionSplash(num); ImageBrush brush = new ImageBrush(); brush.Stretch = Stretch.UniformToFill; brush.ImageSource = backGridInfo; panorama.Background = brush; panorama.Background.Opacity = 0.5; championName.Text = champion.Name; TextBlock loreDescription = new TextBlock(); lore.Text = Code.HtmlRemoval.StripTagsCharArray(champion.Lore); AddInfoComponent(champion.AllyTips, allytips); AddInfoComponent(champion.EnimyTips, enimytips); attackInfo.Value = champion.Info.Attack; defenseInfo.Value = champion.Info.Defense; magicInfo.Value = champion.Info.Magic; difficultyInfo.Value = champion.Info.Difficulty; //incluir habilidades foreach (ChampionSpellDto spell in champion.Spells) { ControlAbillity controlAbillity = new ControlAbillity(spell); abillityChampions.Children.Add(controlAbillity); } CarregarComentarios(); CarregarCounters(); } }