private void comboBox_DropDownOpened(object sender, System.EventArgs e)
        {
            comboBox.Items.Clear();

            string endPointParticipants = @"https://api.challonge.com/v1/tournaments/" + Window1.tournamentID + "/participants.json";
            var clientParticipants = new RestClient(endPointParticipants);
            var jsonParticipants = clientParticipants.MakeRequest("?api_key=dRmpIHLRpgfiepsGWcixpRrettoVeYmSqPw2RJcg");
            JsonSerializer serializerParticipants = new JsonSerializer();
            var dataParticipants = JsonConvert.DeserializeObject<List<Participants>>(jsonParticipants);

            string endPoint = @"https://api.challonge.com/v1/tournaments/1143489/matches.json";
            var client = new RestClient(endPoint);
            var json = client.MakeRequest("?api_key=dRmpIHLRpgfiepsGWcixpRrettoVeYmSqPw2RJcg");
            JsonSerializer serializer = new JsonSerializer();
            var dataMatches = JsonConvert.DeserializeObject<List<Matches>>(json);

            var openMatches = new List<SingleMatch>();

            int finalRound = dataMatches[dataMatches.Count-1].match.round;

            for (int i=0;i<dataMatches.Count;i++)
            {
                if (dataMatches[i].match.state.Equals("open"))
                {
                    for(int j=0; j<dataParticipants.Count; j++)
                    {
                        if(dataMatches[i].match.player1_id.Equals(dataParticipants[j].Participant.id))
                        {
                            this.player1 = dataParticipants[j].Participant.name;
                        }
                        else if (dataMatches[i].match.player2_id.Equals(dataParticipants[j].Participant.id))
                        {
                            this.player2 = dataParticipants[j].Participant.name;
                        }
                    }
                    openMatches.Add(dataMatches[i].match);

                    if (dataMatches[i].match.round == finalRound)
                    {
                        round = "Grand Finals";
                        comboBox.Items.Add(round + ": " + player1 + " vs. " + player2);
                    }
                    else if (dataMatches[i].match.round == finalRound*-1)
                    {
                        round = "Losers Finals";
                        comboBox.Items.Add(round + ": " + player1 + " vs. " + player2);
                    }
                    else if(dataMatches[i].match.round < 0)
                    {
                        round = "Losers Round" + Math.Abs(dataMatches[i].match.round);
                        comboBox.Items.Add(round + ": " + player1 + " vs. " + player2);
                    }
                    else
                    {
                        round = "Winners Round" + Math.Abs(dataMatches[i].match.round);
                        comboBox.Items.Add(round + ": " + player1 + " vs. " + player2);
                    }

                }
            }
        }
        private void comboBox_DropDownOpened(object sender, EventArgs e)
        {
            apiKey = textBox.Text;
            comboBox.Items.Clear();
            string endPoint = @"https://api.challonge.com/v1/tournaments.json";
            var client = new RestClient(endPoint);
            try
            {

                var json = client.MakeRequest("?api_key=" + apiKey);
                JsonSerializer serializer = new JsonSerializer();
                data = JsonConvert.DeserializeObject<List<Tournaments>>(json);

                for (int i = 0; i < data.Count; i++)
                {
                    comboBox.Items.Add(data[i].tournament.name);
                }
            } catch (Exception error)
            {
                MessageBox.Show(error.ToString(), "Error", MessageBoxButton.OK, MessageBoxImage.Error);
            }
        }
        private void loadButton_Click(object sender, RoutedEventArgs e)
        {
            string endPoint = @"https://api.challonge.com/v1/tournaments/" + Window1.tournamentID + "/participants.json";
            var client = new RestClient(endPoint);
            var json = client.MakeRequest("?api_key="+Window1.apiKey);
            JsonSerializer serializer = new JsonSerializer();
            var data = JsonConvert.DeserializeObject<List<Participants>>(json);
            //label.Content = data[0].Participant.name;

            for (int i = 0; i < data.Count; i++)
            {
                playerListView.Items.Add(data[i].Participant.name);
            }
        }