public AddSongViewModel() { this.AddItemCommand = new RelayCommand(AddItem); this.ParentArtists = new ObservableCollection <ARTISTS>(MusicStructureHelper.GetArtists()); this.ParentAlbums = new ObservableCollection <ALBUMS>(); }
private void GetItems() { MusicStructureHelper.InitializeDB(); var children = MusicStructureHelper.GetArtists(); this.Items = new ObservableCollection<MusicItemViewModel>(children. Select(x => new MusicItemViewModel(ItemTypeEnum.Artist, x.Name, x.ID))); }
private void AddItem() { if (SelectedAlbum != null) { MusicStructureHelper.AddSong(SelectedAlbum.ID, SongName); } else { MessageBox.Show("Please select album or artist", "Information", MessageBoxButton.OK, MessageBoxImage.Information); } }
private void Expand() { switch (this.Type) { case ItemTypeEnum.Song: return; case ItemTypeEnum.Album: var songs = MusicStructureHelper.GetAlbumsSongs(this.ID); this.Children = new ObservableCollection <MusicItemViewModel>(songs. Select(x => new MusicItemViewModel(ItemTypeEnum.Song, x.Name, x.ID))); break; case ItemTypeEnum.Artist: var albums = MusicStructureHelper.GetArtistsAlbums(this.ID); this.Children = new ObservableCollection <MusicItemViewModel>(albums. Select(x => new MusicItemViewModel(ItemTypeEnum.Album, x.Name, x.ID))); break; } }