private void ExecuteJumpToTrack(PlayerQueueItem item)
 {
     _player.Playlist.MoveCurrentTo(item);
 }
示例#2
0
        public void Set(IEnumerable<ITrack> tracks)
        {
            if (_dispatcher.CheckAccess())
            {
                _playlist = new List<PlayerQueueItem>();
                _left.Clear();
                _playlistTrackIndex = -1;
                _playlistIndicies = null;

                foreach (var track in tracks)
                {
                    var item = new PlayerQueueItem(false, track);
                    _playlist.Add(item);
                    _left.Add(item);
                }

                var tempQueue = new Queue<PlayerQueueItem>(_queue);
                _queue.Clear();

                while (tempQueue.Count > 0)
                {
                    Enqueue(tempQueue.Dequeue().Track);
                }

                Update();

                _playlistTrackIndex = 0;
                Current = _playlist[_playlistIndicies[_playlistTrackIndex]];

                OnChanged();
            }
            else
            {
                _dispatcher.BeginInvoke((Action<IEnumerable<ITrack>>)Set, tracks);
            }
        }
示例#3
0
        public void Enqueue(IEnumerable<ITrack> tracks)
        {
            if (_dispatcher.CheckAccess())
            {
                lock (_queueLock)
                {
                    foreach (var track in tracks)
                    {
                        var item = new PlayerQueueItem(true, track);
                        _queue.Enqueue(item);
                        if (_playlist.Count > 0)
                        {
                            _left.Insert(_queue.Count, item);
                        }
                        else
                        {
                            _left.Add(item);
                        }
                    }
                }

                OnChanged();
            }
            else
            {
                _dispatcher.BeginInvoke((Action<IEnumerable<ITrack>>)Enqueue, tracks);
            }
        }
示例#4
0
 public bool MoveCurrentTo(PlayerQueueItem item)
 {
     return true;
 }
示例#5
0
        public bool MoveCurrentTo(PlayerQueueItem item)
        {
            int index = _left.IndexOf(item);

            if (index > _playlistTrackIndex)
            {
                while(Current != item)
                {
                    Next();
                }
            }

            return true;
        }