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