HandsOff/TeamCreatorPage.xaml.cs
/// <summary>
/// Adds players to a team based on fields in the GUI.
/// </summary>
/// <returns></returns>
Adds players to a team based on fields in the GUI.
Adds players to a team based on fields in the GUI .
public Team CreateCustomTeam()
        {
            Team team = new Team();
            team.TeamName = TeamNameBox.Text;
            for (int i = 1; i < 12; i++)
            {
                StackPanel stackpanel = (StackPanel)FindName("stackpanel" + i);
                TextBox textBox1 = (TextBox)stackpanel.Children[2];
                TextBox textBox2 = (TextBox)stackpanel.Children[4];
                TextBox textBox5 = (TextBox)stackpanel.Children[6];
                int Speed = (int)long.Parse(textBox1.Text);
                int Attack = (int)long.Parse(textBox2.Text);
                int Defense = (int)long.Parse(textBox5.Text);
                Player player = new Player(i, Attack, Speed, Defense);
                team.AddPlayerToTeam(player);
            }
            return team;
        }
public Team CreateCustomTeam ( ) { Team team = new Team ( ) ; team . TeamName = TeamNameBox . Text ; for ( int i = 1 ; i < 12 ; i ++ ) { StackPanel stackpanel = ( StackPanel ) FindName ( " " + i ) ; TextBox textBox1 = ( TextBox ) stackpanel . Children [ 2 ] ; TextBox textBox2 = ( TextBox ) stackpanel . Children [ 4 ] ; TextBox textBox5 = ( TextBox ) stackpanel . Children [ 6 ] ; int Speed = ( int ) long . Parse ( textBox1 . Text ) ; int Attack = ( int ) long . Parse ( textBox2 . Text ) ; int Defense = ( int ) long . Parse ( textBox5 . Text ) ; Player player = new Player ( i , Attack , Speed , Defense ) ; team . AddPlayerToTeam ( player ) ; } return team ; }
Adds players to a team based on fields in the GUI.
Adds players to a team based on fields in the GUI .
None