void PlayPauseButtonClickHandler(object sender, EventArgs e) { if (player == null) { return; } if (IsPlaying) { player.Pause(); } else { player.Play(); } var title = IsPlaying ? "Play" : "Pause"; playPauseButton.SetTitle(title, UIControlState.Normal); playPauseButton.SetTitle(title, UIControlState.Selected); IsPlaying = !IsPlaying; }
// Action hooked up on Interface Builder partial void playControlClicked(UIButton sender) { paused = !paused; if (player == null) { return; } if (paused) { player.Pause(); } else { player.Play(); } string title = paused ? "Play" : "Pause"; button.SetTitle(title, UIControlState.Normal); button.SetTitle(title, UIControlState.Selected); }