Esempio n. 1
0
 /// <summary>
 /// Adds the range.
 /// </summary>
 /// <param name="mediaItems">The media items.</param>
 public void AddRange(IEnumerable <MediaItem> mediaItems)
 {
     using (BusyStack.GetToken())
     {
         foreach (var item in mediaItems)
         {
             Playlist.Add(item);
         }
     }
 }
Esempio n. 2
0
        /// <summary>
        /// Adds the specified media item.
        /// </summary>
        /// <param name="mediaItem">The media item.</param>
        public void Add(MediaItem mediaItem)
        {
            using (BusyStack.GetToken())
            {
                if (Playlist.Items.Any())
                {
                    var maxIndex = Playlist.Items.Max(p => p.Sequence) + 1;
                    if (maxIndex < 0)
                    {
                        maxIndex = 0;
                    }

                    mediaItem.Sequence = maxIndex;
                }
                else
                {
                    mediaItem.Sequence = 0;
                }

                Playlist.Add(mediaItem);
            }
        }