protected override void OnCreate(Bundle savedInstanceState) { base.OnCreate(savedInstanceState); SetContentView(Resource.Layout.CreateGame); brandLogo = FindViewById <ImageView>(Resource.Id.icon); brandLogo.Visibility = ViewStates.Invisible; // Initialize the settings menu SettingsMenu = FindViewById <ImageButton>(Resource.Id.settingsButton); SettingsMenu.Click += SettingsMenu_Click; // Start the Game button StartGame = FindViewById <Button>(Resource.Id.startGame); StartGame.Enabled = false; ResumeGame = FindViewById <Button>(Resource.Id.resumeGame); SuggestedNames = HelperFunctions.GetNames(); previousPlayersHint = FindViewById <TextView>(Resource.Id.previousPlayersHint); // Initialize listView PlayerNames = FindViewById <ListView>(Resource.Id.playerNames); items = new List <string> { }; // Set up adapter nameAdapter = new CustomListViewAdapter(this, items, Constants.ViewType.NameListItem); PlayerNames.Adapter = nameAdapter; PlayerNames.ItemClick += PlayerNames_ItemClick; // Get Player Name AddPlayer = FindViewById <Button>(Resource.Id.addPlayer); AddPlayer.Click += AddPlayer_Click; StartGame.Click += StartGame_Click; // Get Start Score Spinner selectStartScore = FindViewById <Spinner>(Resource.Id.startScoreSpinner); selectStartScore.ItemSelected += new EventHandler <AdapterView.ItemSelectedEventArgs>(spinner_ItemSelected); List <string> list1 = new List <string>(); list1 = Resources.GetStringArray(Resource.Array.startScoreArray).ToList(); selectStartScore.Adapter = new ArrayAdapter(this, Resource.Layout.spinnerItem, Resource.Id.itemText, list1); selectStartScore.SetSelection(5); // Get Number of legs Spinner legSpinner = FindViewById <Spinner>(Resource.Id.legsSpinner); legSpinner.ItemSelected += new EventHandler <AdapterView.ItemSelectedEventArgs>(legSpinner_ItemSelected); List <string> list2 = new List <string>(); list2 = Resources.GetStringArray(Resource.Array.legsArray).ToList(); legSpinner.Adapter = new ArrayAdapter(this, Resource.Layout.spinnerItem, Resource.Id.itemText, list2); legSpinner.SetSelection(4); gameData = HelperFunctions.CheckForPreviousGame(); if (gameData.player1Name != "" && (Convert.ToInt32(gameData.player1Score) > 0 || Convert.ToInt32(gameData.player2Score) > 0)) { ResumeGame.Visibility = ViewStates.Visible; previousPlayersHint.Visibility = ViewStates.Visible; string hintText = "{0} {1} V {2} {3}"; previousPlayersHint.Text = String.Format(hintText, gameData.player1Name, gameData.player1Score, gameData.player2Score, gameData.player2Name); ResumeGame.Click += ResumeGame_Click; } }
private void SuggestedNamesListView_ItemLongClick(object sender, AdapterView.ItemLongClickEventArgs e) { SuggestedNames = HelperFunctions.DeleteName(SuggestedNames, SuggestedNames[e.Position]); }