private void examineTeamSpinner_ItemSelected (object sender, AdapterView.ItemSelectedEventArgs e) { Spinner spinner = (Spinner)sender; String selTeam = (string)spinner.GetItemAtPosition (e.Position); currentTeam = simLeague.leagueTeams.Find (t => t.name == selTeam); updateCurrTeam (); }
protected override void OnCreate (Bundle savedInstanceState) { base.OnCreate (savedInstanceState); SetContentView (Resource.Layout.Season); //Create your application here String userTeam = "ha"; userTeam = Intent.Extras.GetString ("userTeam"); simLeague = new League (userTeam); currentTeam = simLeague.leagueTeams.ElementAt (0); currTab = 0; TextView currentTeamText = FindViewById<TextView> (Resource.Id.currentTeamText); currentTeamText.Text = simLeague.userTeam.name; //Set up spinner with all teams Spinner examineTeamSpinner = FindViewById<Spinner> (Resource.Id.examineTeamSpinner); examineTeamSpinner.ItemSelected += new EventHandler<AdapterView.ItemSelectedEventArgs> (examineTeamSpinner_ItemSelected); var adapter = ArrayAdapter.CreateFromResource ( this, Resource.Array.teams_array, Android.Resource.Layout.SimpleSpinnerItem); adapter.SetDropDownViewResource (Android.Resource.Layout.SimpleSpinnerDropDownItem); examineTeamSpinner.Adapter = adapter; //Set up "Simulate Game" button Button simGameButton = FindViewById<Button> (Resource.Id.simGameButton); simGameButton.Click += (sender, e) => { simLeague.simGame(); updateCurrTeam(); }; //Set up "Team Stats" button Button teamStatsButton = FindViewById<Button> (Resource.Id.teamStatsButton); teamStatsButton.Click += (sender, e) => { currTab = 0; updateTeamStats(); }; //Set up "Player Stats" button Button playerStatsButton = FindViewById<Button> (Resource.Id.playerStatsButton); playerStatsButton.Click += (sender, e) => { currTab = 1; updatePlayerStats(); }; //Set up "Team Schedule" button Button teamScheduleButton = FindViewById<Button> (Resource.Id.teamScheduleButton); teamScheduleButton.Click += (sender, e) => { currTab = 2; updateSchedule(); }; }
public League (string userTeamStr) { leagueTeams = new List<Team> (); leagueTeams.Add (new Team ("Alabama", 95, false)); leagueTeams.Add (new Team ("Auburn", 90, false)); leagueTeams.Add (new Team ("Florida", 90, false)); leagueTeams.Add (new Team ("Georgia", 90, false)); leagueTeams.Add (new Team ("LSU", 90, false)); userTeam = leagueTeams.Find (t => t.name == userTeamStr); }