Пример #1
0
        public ModelPlaylist CreatePlaylist(uint aId)
        {
            lock (iLock)
            {
                ModelPlaylist playlist;
                if (iModelPlaylistList.TryGetValue(aId, out playlist))
                {
                    playlist.IncRef();
                    RemoveStalePlaylists();
                    return(playlist);
                }

                playlist = new ModelPlaylist(aId, iServicePlaylistManager);
                playlist.IncRef();

                iIdArray.Lock();

                int index = iIdArray.Index(aId);
                Assert.Check(index != -1);
                uint token = iTokenArray[index];
                playlist.Open(token);

                iIdArray.Unlock();

                iModelPlaylistList.Add(playlist.Id, playlist);

                RemoveStalePlaylists();

                return(playlist);
            }
        }
Пример #2
0
        public ModelPlaylist Insert(uint aAfterId, string aName, string aDescription, uint aImageId)
        {
            uint          newId = iServicePlaylistManager.PlaylistInsertSync(aAfterId, aName, aDescription, aImageId);
            ModelPlaylist p     = new ModelPlaylist(newId, iServicePlaylistManager);

            p.Open(0);
            return(p);
        }