public EditSongViewModel(Song song) { Song = song; Title = Song.Title; Artist = Song.Artist; Duration = Song.Duration; Art = Song.Image; SelectedArt = Song.Image; _artRepo = new ArtRepository(); ArtSelection = new ObservableCollection<string>(_artRepo.GetAlbumArt()); _songRepo = new SongRepository(); CloseEditSongViewCommand = new RelayCommand(new Action<object>(CloseEditSongView)); SaveChangesToSongCommand = new RelayCommand(new Action<object>(SaveChanges), Predicate => { if (TitleRule.TitleRegex.IsMatch(Title) && TitleRule.TitleRegex.IsMatch(Artist) && DurationRule.DurationRegex.IsMatch(Duration)) { return true; } else { return false; } }); }
private void UpdateSong(Song song) { Song = song; }
private void SetEditSongViewModel(Song song) { VariableViewModel = new EditSongViewModel(song); }
private void DeleteSong(Song song) { _songRepository.DeleteSong(song); RefreshViewModels(); }