Ejemplo n.º 1
0
 public TreeReleaseItem(TreeArtistItem artistItem, Release release, bool showImage, bool showEmptyImage)
 {
     this.ArtistItem = artistItem;
     this.Release = release;
     this.showImage = showImage;
     this.showEmptyImage = showEmptyImage;
 }
Ejemplo n.º 2
0
 public TreeReleaseItem(TreeArtistItem artistItem, Release release, bool showImage, bool showEmptyImage)
 {
     this.ArtistItem     = artistItem;
     this.Release        = release;
     this.showImage      = showImage;
     this.showEmptyImage = showEmptyImage;
 }
Ejemplo n.º 3
0
        public void LoadReleases(Release[] releases)
        {
            this.releaseItemByReleaseId.Clear();
            this.releasesByAlbumArtist.Clear();
            this.ArtistItems.Clear();

            if (releases != null)
            {
                if (this.collectionManager == null)
                {
                    throw new InvalidOperationException("You should set CollectionManager before calling any other methods.");
                }

                bool showImages = this.CollectionManager.Settings.ShowImagesInReleaseTree;

                foreach (Release release in releases)
                {
                    SortedSet<Release> list;
                    if (!this.releasesByAlbumArtist.TryGetValue(release.JoinedAlbumArtists, out list))
                    {
                        this.releasesByAlbumArtist[release.JoinedAlbumArtists] = list = new SortedSet<Release>(this.GetComparer());
                    }
                    list.Add(release);
                }

                foreach (KeyValuePair<string, SortedSet<Release>> albumArtist in this.releasesByAlbumArtist)
                {
                    bool showEmptyImage = albumArtist.Value.Any(r => r.Thumbnail != null);

                    TreeArtistItem artistItem = new TreeArtistItem()
                    {
                        Title = albumArtist.Key,
                        Releases = new List<TreeReleaseItem>()
                    };

                    foreach (Release release in albumArtist.Value)
                    {
                        TreeReleaseItem releaseItem = new TreeReleaseItem(artistItem, release, showImages, showEmptyImage);
                        this.releaseItemByReleaseId[release.Id] = releaseItem;
                        artistItem.Releases.Add(releaseItem);
                    }

                    this.ArtistItems.Add(artistItem);
                }
            }
        }