protected internal override async Task Delete(string playlistId) { try { IsDeleting = true; await _getDataSource().RemovePlaylist(playlistId); var item = Items.FirstOrDefault(i => i.Id == playlistId); if (item == null) { return; } Items.Remove(item); App.ViewModel.PlaylistListViewModel.Items.Clear(); _playlistsChangeHandler.UpdatePlaylists(); } catch (Exception e) { throw new LiteTubeException(e); } finally { IsDeleting = false; } }
private async void CreatePlaylist() { var newPlaylist = await _getGeDataSource().AddNewPlaylist(PlaylistTitle, PlaylistDescription, _selectedAccess.Status); if (newPlaylist != null) { PlaylistListViewModel.Items.Insert(0, new PlaylistNodeViewModel(newPlaylist, _getGeDataSource(), new DeleteContextMenuStrategy(), PlaylistListViewModel.Delete, false)); _playlistsChangeHandler.UpdatePlaylists(); } //Clear data PlaylistTitle = string.Empty; PlaylistDescription = string.Empty; SelectedAccess = AccessItems.First(); }