private void ExecuteJumpToTrack(PlayerQueueItem item) { _player.Playlist.MoveCurrentTo(item); }
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); } }
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); } }
public bool MoveCurrentTo(PlayerQueueItem item) { return true; }
public bool MoveCurrentTo(PlayerQueueItem item) { int index = _left.IndexOf(item); if (index > _playlistTrackIndex) { while(Current != item) { Next(); } } return true; }