예제 #1
0
        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;
                }
            });
        }
예제 #2
0
 private void UpdateSong(Song song)
 {
     Song = song;
 }
예제 #3
0
 private void SetEditSongViewModel(Song song)
 {
     VariableViewModel = new EditSongViewModel(song);
 }
예제 #4
0
 private void DeleteSong(Song song)
 {
     _songRepository.DeleteSong(song);
     RefreshViewModels();
 }