Exemple #1
0
        private void OnPlaybackEndedEvent()
        {
            if (_isRepeatOn && _isSuffleOn)
            {
                int    numOfTracks = _playlistForm.GetTrackCount();
                Random random      = new Random();
                _playlistForm.SetSelected(random.Next(numOfTracks));

                // next has been selected, start playing it
                OnPlaybackPlay();
            }
            else if (_isRepeatOn)
            {
                if (_playlistForm.IsLastSelected())
                {
                    _playlistForm.SetSelected(0);
                    OnPlaybackPlay();
                }
                else
                {
                    OnPlaybackNext();
                }
            }
            else if (_isSuffleOn)
            {
                // select a random one
                int    numOfTracks = _playlistForm.GetTrackCount();
                Random random      = new Random();
                _playlistForm.SetSelected(random.Next(numOfTracks));

                // next has been selected, start playing it
                OnPlaybackPlay();
            }
            else
            {
                if (!_playlistForm.IsLastSelected())
                {
                    OnPlaybackNext();
                }
            }
        }