private void _admin_ShowTeamsRanking(RankingTeamInfos[] rankings, int season) { lblSeason.Content = season; lvRanking.Items.Clear(); lvTeamsRanking.Items.Clear(); Border[] borders = new Border[3] { bg_first, bg_second, bg_third }; Border[] frames = new Border[3] { frame_first, frame_second, frame_third }; TextBlock[] textblocks = new TextBlock[3] { tb_first, tb_second, tb_third }; StackPanel[] panels = new StackPanel[3] { panel_first, panel_second, panel_third }; for (int i = 0; i < 3; i++) { panels[i].Visibility = Visibility.Hidden; textblocks[i].Text = "NR"; borders[i].Background = null; frames[i].Background = new SolidColorBrush(Colors.White); } foreach (RankingTeamInfos info in rankings) { RankingTeamItem item = new RankingTeamItem { Name = info.Name, Wins = info.Wins, Loses = info.Loses, Rank = info.Rank, Score = info.Score, TeamID = info.TeamID }; lvTeamsRanking.Items.Add(item); } for (int i = 0; i < Math.Min(3, rankings.Length); i++) { ImageBrush bg = new ImageBrush(PicsManager.GetTeamEmblem(rankings[i].TeamID, rankings[i].Emblem)); bg.Stretch = Stretch.UniformToFill; frames[i].Background = bg; frames[i].CornerRadius = new CornerRadius(10, 10, 50, 50); } bd_playersranking.Visibility = Visibility.Hidden; bd_teamsrankings.Visibility = Visibility.Visible; this.Show(); Application.Current.Dispatcher.BeginInvoke(System.Windows.Threading.DispatcherPriority.Normal, new Action(() => this.Activate())); }
private void LvTeamsRanking_MouseDoubleClick(object sender, MouseButtonEventArgs e) { if (lvTeamsRanking.SelectedIndex == -1) { return; } RankingTeamItem target = lvTeamsRanking.SelectedItem as RankingTeamItem; if (target != null) { _admin.SendAskTeamProfile(target.TeamID); } }