private void OnPlaylistAdded(object sender, PlaylistEventArgs e) { if (Dispatcher.CheckAccess()) { _items.Insert(e.Position, new PlaylistNavigationItem(e.Playlist, RegionManager)); } else { Dispatcher.BeginInvoke(new Action<object, PlaylistEventArgs>(OnPlaylistAdded), sender, e); } }
private void OnPlaylistRemoved(object sender, PlaylistEventArgs e) { if (Dispatcher.CheckAccess()) { var itemToRemove = _items.FirstOrDefault(i => i.Playlist == e.Playlist); if (itemToRemove != null) { _items.Remove(itemToRemove); } } else { Dispatcher.BeginInvoke(new Action<object, PlaylistEventArgs>(OnPlaylistRemoved), sender, e); } }
private void OnPlaylistContainerPlaylistRemoved(object sender, PlaylistEventArgs e) { _logger.Log("Playlist removed", Category.Info, Priority.Medium); if (e.Position < _playlists.Count) { ITorshifyPlaylist p = _playlists[e.Position]; _dispatcher.Invoke((Action<int>)_playlists.RemoveAt, e.Position); OnPlaylistRemoved(new Infrastructure.Interfaces.PlaylistEventArgs(p, e.Position)); } }
private void OnPlaylistContainerPlaylistAdded(object sender, PlaylistEventArgs e) { _logger.Log("Playlist added", Category.Info, Priority.Medium); InsertAt(e.Playlist, e.Position); }
private void OnPlaylistContainerPlaylistRemoved(object sender, PlaylistEventArgs e) { _logger.Log("Playlist removed", Category.Info, Priority.Medium); ITorshifyPlaylist p = _playlists[e.Position]; OnPlaylistRemoved(new Infrastructure.Interfaces.PlaylistEventArgs(p, e.Position)); }