protected void SaveGameAndPlayer() { // Create an array to store player into List<GamePlayer> attendees = new List<GamePlayer>(); int listItemCount = _playersListView.ChildCount; for (int i = 0; i < listItemCount; i++) { CheckBox cbox = (_playersListView.GetChildAt(i)).FindViewById<CheckBox>(Resource.Id.playerCheckbox); if (cbox.Checked) { attendees.Add(new GamePlayer() { PlayerId = (int)GameData.PlayerService.Players[i].Id, PlayerAlias = GameData.PlayerService.Players[i].Name, Score = 0 }); } } Game game = new Game() { Name = Arguments.GetString("game_name"), Players = attendees }; GameData.Service.SaveGame(game); //StartActivity(typeof(GamesActivity)); var fragment = new GameFragment(); Bundle bundle = new Bundle(); bundle.PutInt("game_id", (int)game.Id); fragment.Arguments = bundle; var trans = Activity.SupportFragmentManager.BeginTransaction(); trans.Add(Resource.Id.fragmentContainer, fragment, "GameFragment"); trans.Commit(); }
protected void GameClicked(object sender, ListView.ItemClickEventArgs e) { var fragment = new GameFragment(); Bundle bundle = new Bundle(); bundle.PutInt("game_id", (int)e.Id); fragment.Arguments = bundle; var activity = Activity as MainActivity; //activity.ShowFragment(fragment); var trans = Activity.SupportFragmentManager.BeginTransaction(); trans.Add(_fragmentContainer.Id, fragment, "GameFragment"); trans.Hide(this); trans.AddToBackStack(null); activity.StackFragments.Push(this); trans.Commit(); // setup the intent to pass //Intent gameIntent = new Intent(this, typeof(GameActivity)); //gameIntent.PutExtra("game_id", (int)e.Id); //StartActivity(gameIntent); }