public static ObservableCollection <ITrackViewModel> MakeObservableTracks(IAlbumViewModel album, MusicLogClient musicLog)
        {
            var tracks = new ObservableCollection <ITrackViewModel>();

            foreach (ITrack vanillaTrack in musicLog.GetTracks(album.Album))
            {
                tracks.Add(MakeTrackViewModel(vanillaTrack));
            }
            return(tracks);
        }
        private void SetProgressForActiveAlbums()
        {
            if (SelectedPlaylist == null || SelectedPlaylist.Albums.Count == 0)
            {
                return;
            }

            foreach (var album in ActiveAlbums)
            {
                List <ITrack> tracks             = _musicLog.GetTracks(album.Album);
                int           listenedCountTrack = tracks.Where(t => t.LastListenedUnix != 0).Count();
                int           totalCountTrack    = tracks.Count();
                album.SetProgress(listenedCountTrack, totalCountTrack);
            }
        }
Example #3
0
        private void AddCustomTrack(object obj)
        {
            var dialog = new TextBoxWindow();

            if (dialog.ShowDialog() == true)
            {
                var track = new CustomTrack()
                {
                    Name    = dialog.ResponseText,
                    TrackNo = _musicLog.GetTracks(SelectedAlbum.Album).Count() + 1
                };

                _musicLog.AddTrack(track, SelectedAlbum.Album);
                ActiveTracks.Add(new CustomTrackViewModel(track));
            }
        }