Chirp.Radio.Agent.AudioPlayer.OnUserAction C# (CSharp) Method

OnUserAction() protected method

Called when the user requests an action using application/system provided UI
User actions do not automatically make any changes in system state; the agent is responsible for carrying out the user actions if they are supported. Call NotifyComplete() only once, after the agent request has been completed, including async callbacks.
protected OnUserAction ( BackgroundAudioPlayer player, AudioTrack track, UserAction action, object param ) : void
player BackgroundAudioPlayer The BackgroundAudioPlayer
track AudioTrack The track playing at the time of the user action
action UserAction The action the user has requested
param object The data associated with the requested action. /// In the current version this parameter is only for use with the Seek action, /// to indicate the requested position of an audio track
return void
        protected override void OnUserAction(BackgroundAudioPlayer player, AudioTrack track, UserAction action, object param)
        {
            switch (action)
            {
                case UserAction.Play:
                    if (player.PlayerState != PlayState.Playing)
                    {
                        player.Play();
                    }
                    break;
                case UserAction.Stop:
                    player.Stop();
                    break;
                case UserAction.Pause:
                    player.Pause();
                    break;
                case UserAction.FastForward:
                    player.FastForward();
                    break;
                case UserAction.Rewind:
                    player.Rewind();
                    break;
                case UserAction.Seek:
                    player.Position = (TimeSpan)param;
                    break;
                case UserAction.SkipNext:
                    //player.Track = GetNextTrack();
                    break;
                case UserAction.SkipPrevious:
                    //AudioTrack previousTrack = GetPreviousTrack();
                    //if (previousTrack != null)
                    //{
                    //    player.Track = previousTrack;
                    //}
                    break;
            }

            NotifyComplete();
        }