public void FillComboBox(ArenaLadder ladder) { if (ladder.ArenaTeams == null) return; var realms = ladder.ArenaTeams.Select(team => team.Realm).Distinct().ToArray(); comboBox1.Items.Clear(); comboBox1.Items.Insert(0, ""); comboBox1.Items.AddRange(realms); }
private void FillListView(ArenaLadder ladder) { if (ladderView.InvokeRequired) { ladderView.Invoke(new AddListViewItems(FillListView), ladder); } else { Ladder = ladder; m_filterForm.FillComboBox(Ladder); if (Ladder.ArenaTeams == null) { ladderView.Items.Clear(); Text = String.Format("WoW Arena Ladder - {0}-{1}: 0 of 0 teams displayed", m_battlegroupName, m_client.Region.ToUpper()); return; } ladderView.BeginUpdate(); ladderView.Items.Clear(); Task<ListViewItem[]>.Factory.StartNew(() => { ListViewItem[] items = new ListViewItem[Ladder.ArenaTeams.Length]; for (int i = 0; i < items.Length; ++i) items[i] = CreateListViewItemFromTeam(Ladder.ArenaTeams[i]); return items; }).ContinueWith((t) => { for (int i = 0; i < t.Result.Length; ++i) AddListViewItem(t.Result[i]); }).ContinueWith((t) => Finish()); } }
private void QueryData() { Ladder = m_client.GetArenaLadder(m_battlegroupSlug, m_size, 2000); m_filterForm.FillComboBox(Ladder); if (Ladder.ArenaTeams == null) { ladderView.Items.Clear(); Text = String.Format("WoW Arena Ladder - {0}-{1}: 0 of 0 teams displayed", m_battlegroupName, m_client.Region.ToUpper()); return; } ladderView.BeginUpdate(); ladderView.Items.Clear(); foreach (var team in Ladder.ArenaTeams) ladderView.Items.Add(CreateListViewItemFromTeam(team)); ladderView.EndUpdate(); Text = String.Format("WoW Arena Ladder -{0}-{1}: {2} of {3} teams displayed", m_battlegroupName, m_client.Region.ToUpper(), ladderView.Items.Count, Ladder.ArenaTeams.Length); }