private async void SubmitButton_Clicked(object sender, EventArgs e) //handles all the logic when the submit button is clicked { await Dartboard.RotateTo(360, 1000); Dartboard.Rotation = 0; throwValue = computeScore(Convert.ToString(colorPicker.SelectedItem), Convert.ToInt32(numberPicker.SelectedItem)); //throwValue = whatever values were put into the pickers by the user. if (currentTeam == "Team 1") //currentTeam is set to "Team 1" by default. This is why whichever team goes first needs to be set to Team 1. { if (!(Convert.ToString(colorPicker.SelectedItem) == "Red" || Convert.ToString(colorPicker.SelectedItem) == "Yellow")) { if (teamAScore == Preferences.Get("startingGameScore", 0)) //the logic that requires the user to begin scoring by hitting a double { DisplayAlert("Invalid", "A double (the red section of the dart board) is required to begin scoring", "Ok"); throwValue = 0; } } teamAScore -= throwValue; //Team A score is equal to itself minus whatever the throwValue is Preferences.Set("teamAScore", teamAScore); //store teamA's updated score currentTeamScore.Text = teamAScore.ToString(); //updating the scoreLabel that displays at the top of the screen. teamABustCheck(); //checks if team A busted after clicking the submit button counter++; //incrementing the counter to determine if it is still this team's turn if (counter > 3) //switches teams and displays an alert showing the current team's score. { teamASwitch(); } } else //everything in this else statement is practically the same as the above, just for the opposite team. { if (!(Convert.ToString(colorPicker.SelectedItem) == "Red" || Convert.ToString(colorPicker.SelectedItem) == "Yellow")) { if (teamBScore == Preferences.Get("startingGameScore", 0)) { DisplayAlert("Invalid", "A double (the red section of the dart board) is required to begin scoring", "Ok"); throwValue = 0; } } teamBScore -= throwValue; Preferences.Set("teamBScore", teamBScore); currentTeamScore.Text = teamBScore.ToString(); teamBBustCheck(); counter++; if (counter > 3) { teamBSwitch(); } } }