HasNext() public méthode

public HasNext ( ) : bool
Résultat bool
Exemple #1
0
        public async Task PlayNext()
        {
            await RaiseMediaFileFailedEventOnException(async() =>
            {
                if (MediaQueue.HasNext())
                {
                    MediaQueue.SetNextAsCurrent();

                    await PlayCurrent();
                }
                else
                {
                    MediaQueue.SetIndexAsCurrent(0);

                    await PrepareCurrentAndThen(async() =>
                    {
                        await CurrentPlaybackManager.Play();
                        await CurrentPlaybackManager.Pause();
                        await Seek(TimeSpan.Zero);
                    });

                    OnMediaFileChanged(this, new MediaFileChangedEventArgs(CurrentMediaFile));
                }
            });
        }
        public async Task PlayNext()
        {
            try
            {
                if (MediaQueue.HasNext())
                {
                    //await CurrentPlaybackManager.Pause();
                    MediaQueue.SetNextAsCurrent();
                    var beforePlayTask = _onBeforePlay?.Invoke(_currentMediaFile);
                    if (beforePlayTask != null)
                    {
                        await beforePlayTask;
                    }
                    await Task.WhenAll(
                        CurrentPlaybackManager.Play(_currentMediaFile),
                        GetMediaInformation(new[] { _currentMediaFile }));
                }
                else
                {
                    await CurrentPlaybackManager.Pause();

                    MediaQueue.SetIndexAsCurrent(0);
                    OnMediaFileChanged(this, new MediaFileChangedEventArgs(MediaQueue.Current));
                }
            }
            catch (Exception ex)
            {
                OnMediaFileFailed(CurrentPlaybackManager, new MediaFileFailedEventArgs(ex, _currentMediaFile));
                throw;
            }
        }
        public async Task PlayNext()
        {
            if (MediaQueue.HasNext())
            {
                await CurrentPlaybackManager.Stop();

                MediaQueue.SetNextAsCurrent();
                await Task.WhenAll(
                    CurrentPlaybackManager.Play(_currentMediaFile),
                    GetMediaInformation(new[] { _currentMediaFile }));
            }
            else
            {
                // If you don't have a next song in the queue, stop and show the meta-data of the first song.
                //TODO: Shouldn't we Pause here instead of stop? Stop should shut down everything
                await CurrentPlaybackManager.Stop();

                MediaQueue.SetIndexAsCurrent(0);
            }
        }