private void FetchScores() { System.Net.WebClient client = new System.Net.WebClient(); string json = client.DownloadString("http://sybrandbos.nl/website/API/results.php?key=J93hdb4Ua83AkVWo0cbxIsn2ibw3nlxX3"); fetchedScores = JsonConvert.DeserializeObject <FetchScores.RootObject>(json); }
public void initializeTeams() { json = new System.Net.WebClient().DownloadString("http://sybrandbos.nl/website/API/results.php?key=J93hdb4Ua83AkVWo0cbxIsn2ibw3nlxX3"); fetchedScore = JsonConvert.DeserializeObject <FetchScores.RootObject>(json); teamsLabel.Text = matchComboBox.Text; matchLabel.Text = "De stand is nog niet bekend."; for (int i = 0; i < fetchedScore.Records.Count; i++) { string format = "{0} - {1}"; string match = string.Format(format, fetchedScore.Records[i].firstteam, fetchedScore.Records[i].secondteam); if (match == matchComboBox.Text) { matchLabel.Text = string.Format(format, fetchedScore.Records[i].firstscore, fetchedScore.Records[i].secondscore);; } } }