private async void kryptonTextBox2_TextChanged(object sender, EventArgs e) { kryptonDataGridView3.Rows.Clear(); await Task.Delay(500); if (filterText != kryptonTextBox2.Text) { filterText = kryptonTextBox2.Text; Uri apiLOB = new Uri(@"https://aoe2.net/api/leaderboard?game=aoe2de&leaderboard_id=3&start=1&search=" + kryptonTextBox2.Text); string jsonLOBBIES = await DownloadStringAsync(apiLOB); //MessageBox.Show(jsonLOBBIES.Substring(0, 8)); var ldb = QueryPlayer.FromJson(jsonLOBBIES); int i = 1; foreach (var l in ldb.Leaderboard) { i++; LinkLabel ln = new LinkLabel(); Button btn = new Button(); ln.Text = "View"; ln.Name = "view" + i.ToString(); btn.Name = "btn" + i.ToString(); btn.Text = "Join"; kryptonDataGridView3.Rows.Add(l.Rank, l.Name, l.Rating, l.Games, "View", "View", @"https://www.ageofempires.com/stats/?profileId=" + l.ProfileId + @"&game=age2", @"http://steamcommunity.com/profiles/" + l.SteamId); } RemoveDuplicate(kryptonDataGridView3); } if (kryptonTextBox2.Text == null) { kryptonDataGridView3.Rows.Clear(); } }
public static string ToJson(this QueryPlayer self) => JsonConvert.SerializeObject(self, DEBoard.Converter.Settings);