コード例 #1
0
        /// <summary>
        /// Delete a single TaggedAlbum from the tag
        /// </summary>
        /// <param name="album"></param>
        public void DeleteTaggedAlbum(TaggedAlbum album)
        {
            if (PersistTag == true)
            {
                DBTest.TaggedAlbums.DeleteTaggedAlbum(album);
            }

            TaggedAlbums.Remove(album);
            AlbumToTagLookup.Remove(album.AlbumId);
        }
コード例 #2
0
        /// <summary>
        /// Move a set of selected items down and update the tag indexes
        /// </summary>
        /// <param name="items"></param>
        public void MoveItemsDown(IEnumerable <TaggedAlbum> items)
        {
            // There must be at least one TaggedAlbum entry beyond those that are selected. That entry needs to be moved to above the start of the selection
            TaggedAlbum itemToMove = TaggedAlbums[items.Last().TagIndex + 1];

            TaggedAlbums.RemoveAt(items.Last().TagIndex + 1);
            TaggedAlbums.Insert(items.First().TagIndex, itemToMove);

            // Now the tag index numbers in the TaggedAlbum entries must be updated to match their index in the collection
            AdjustTagIndexes();
        }
コード例 #3
0
        /// <summary>
        /// Add a TaggedAlbum to the Tag
        /// </summary>
        /// <param name="album"></param>
        public void AddTaggedAlbum(TaggedAlbum album)
        {
            album.TagIndex = TaggedAlbums.Count;
            album.TagId    = Id;

            if (PersistTag == true)
            {
                DBTest.TaggedAlbums.AddTaggedAlbum(album);
            }

            TaggedAlbums.Add(album);
            AlbumToTagLookup[album.AlbumId] = album;
        }
コード例 #4
0
        /// <summary>
        /// Adjust the tag index numbers to match the indexes in the collection
        /// </summary>
        /// <param name="thePlaylist"></param>
        public void AdjustTagIndexes()
        {
            // The track numbers in the PlaylistItems must be updated to match their index in the collection
            for (int index = 0; index < TaggedAlbums.Count; ++index)
            {
                TaggedAlbum itemToCheck = TaggedAlbums[index];
                if (itemToCheck.TagIndex != index)
                {
                    itemToCheck.TagIndex = index;

                    // Update the item in the model. No need to wait for this.
                    DbAccess.UpdateAsync(itemToCheck);
                }
            }
        }
コード例 #5
0
ファイル: TaggedAlbums.cs プロジェクト: GrumpyTrev/DNLACore
 /// <summary>
 /// Add a new TaggedAlbum to the storage and the local collections
 /// </summary>
 /// <param name="artistAlbumToAdd"></param>
 public static void AddTaggedAlbum(TaggedAlbum taggedAlbumToAdd)
 {
     // No need to wait for the TaggedAlbum to be added to storage
     DbAccess.InsertAsync(taggedAlbumToAdd);
     TaggedAlbumCollection.Add(taggedAlbumToAdd);
 }
コード例 #6
0
ファイル: TaggedAlbums.cs プロジェクト: GrumpyTrev/DNLACore
 /// <summary>
 /// Delete the specified TaggedAlbum from the storage and the collection
 /// </summary>
 /// <param name="taggedAlbumToDelete"></param>
 /// <returns></returns>
 public static void DeleteTaggedAlbum(TaggedAlbum taggedAlbumToDelete)
 {
     // No need to wait for the TaggedAlbum to be deleted from storage
     DbAccess.DeleteAsync(taggedAlbumToDelete);
     TaggedAlbumCollection.Remove(taggedAlbumToDelete);
 }