Exemplo n.º 1
0
        private void __GoBack()
        {
            // Note: CanGoBack で呼び分けが行われている前提の元で例外送出を行っている

            var prevItem  = default(PlaylistItem);
            int prevIndex = CurrentIndex - 1;

            if (PlaylistSettings.IsShuffleEnable)
            {
                prevItem = PlayedItems.Dequeue();
            }
            else
            {
                if (prevIndex < 0)
                {
                    if (RepeatMode != MediaPlaybackAutoRepeatMode.List)
                    {
                        throw new Exception();
                    }
                    else
                    {
                        prevIndex = SourceItems.Count - 1;
                    }
                }

                prevItem = SourceItems.ElementAt(prevIndex);
            }

            if (prevItem != null)
            {
                Current      = prevItem;
                CurrentIndex = prevIndex;

                PlayRequested?.Invoke(this, prevItem);
            }
            else
            {
                throw new Exception();
            }
        }