private void LvRanking_MouseDoubleClick(object sender, MouseButtonEventArgs e) { if (lvRanking.SelectedIndex == -1) { return; } RankingPlayerItem target = lvRanking.SelectedItem as RankingPlayerItem; if (target != null) { Profil profile = new Profil(_admin.Client.ProfilAdmin); _admin.SendAskProfil(target.UserID); } }
private void _admin_ShowRanking(RankingPlayerInfos[] infos, Customization[] customs, 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.Visible; textblocks[i].Text = "NR"; borders[i].Background = null; frames[i].Background = new SolidColorBrush(Colors.White); } foreach (RankingPlayerInfos info in infos) { RankingPlayerItem item = new RankingPlayerItem { ELO = info.ELO, Rank = info.Rank, RankedLose = info.RankedLose, RankedWin = info.RankedWin, UserID = info.UserID, Username = info.Username, Team = info.Team }; if (info.RankedLose == 0 & info.RankedWin == 0) { item.WinRate = 1.0; } else { item.WinRate = Math.Round(((double)info.RankedWin) / (info.RankedLose + info.RankedWin), 2); } lvRanking.Items.Add(item); } bd_playersranking.Visibility = Visibility.Visible; bd_teamsrankings.Visibility = Visibility.Hidden; for (int i = 0; i < customs.Length; i++) { textblocks[i].Text = infos[i].Username; borders[i].Background = new ImageBrush(PicsManager.GetCustom(customs[i])); frames[i].CornerRadius = new CornerRadius(50, 50, 10, 10); borders[i].CornerRadius = new CornerRadius(200); } this.Show(); Application.Current.Dispatcher.BeginInvoke(System.Windows.Threading.DispatcherPriority.Normal, new Action(() => this.Activate())); }