Ejemplo n.º 1
0
        private async void TNBox1_Validated(object sender, EventArgs e)
        // once you enter the team that in the tournament, it will auto fill the memebers' name
        {
            int     counter = 0;
            Team    tmpTeam = new Team();
            TextBox tmp     = (TextBox)sender;
            string  result  = await ApiHandler.getTeams(Test.tournamentID);

            List <Team> teams = ApiHandler.jsonTo <List <Team> >(result);

            foreach (Team t in teams)
            {
                if (t.name.Equals(TNBox1.Text))
                {
                    tmpTeam = t;// get the team we entered in the team name box
                    team1ID = t.id;
                    break;
                }
            }
            result = await ApiHandler.getPlayers(tmpTeam.id);

            List <Player> players = ApiHandler.jsonTo <List <Player> >(result);

            foreach (Control c in tmp.Parent.Controls)  //get all the members' name and auto fill it
            {
                if (c is GroupBox)
                {
                    if (c.Name.Equals("Team1"))
                    {
                        foreach (Control t in c.Controls)
                        {
                            if (t is TextBox)
                            {
                                t.Text = players[counter].name;
                                counter++;
                            }
                        }
                    }
                }
            }
        }
Ejemplo n.º 2
0
        // same with team name box 1
        private async void TNBox2_Validated(object sender, EventArgs e)
        {
            int     counter = 0;
            Team    tmpTeam = new Team();
            TextBox tmp     = (TextBox)sender;
            string  result  = await ApiHandler.getTeams(Test.tournamentID);

            List <Team> teams = ApiHandler.jsonTo <List <Team> >(result);

            foreach (Team t in teams)
            {
                if (t.name.Equals(TNBox2.Text))
                {
                    tmpTeam = t;
                    team2ID = t.id;
                    break;
                }
            }
            result = await ApiHandler.getPlayers(tmpTeam.id);

            List <Player> players = ApiHandler.jsonTo <List <Player> >(result);

            foreach (Control c in tmp.Parent.Controls)
            {
                if (c is GroupBox)
                {
                    if (c.Name.Equals("Team2"))
                    {
                        foreach (Control t in c.Controls)
                        {
                            if (t is TextBox)
                            {
                                t.Text = players[counter].name;
                                counter++;
                            }
                        }
                    }
                }
            }
        }