void musicButton_Tapped(object sender, EventArgs e) { BooleanButton button = sender as BooleanButton; // In a real game, you'd want to store away the value of // the button to turn off music here. :) }
public PhoneMainMenuScreen() : base("Main Menu") { // Create a button to start the game Button playButton = new Button("Play"); playButton.Tapped += playButton_Tapped; MenuButtons.Add(playButton); // Create two buttons to toggle sound effects and music. This sample just shows one way // of making and using these buttons; it doesn't actually have sound effects or music BooleanButton sfxButton = new BooleanButton("Sound Effects", true); sfxButton.Tapped += sfxButton_Tapped; MenuButtons.Add(sfxButton); BooleanButton musicButton = new BooleanButton("Music", true); musicButton.Tapped += musicButton_Tapped; MenuButtons.Add(musicButton); }