示例#1
0
        public void OnListPlaylistInfoResponseReceived(string name, IEnumerable <MPDSongResponseBlock> response)
        {
            IList <LibraryItem> contents = new List <LibraryItem>();

            foreach (MPDSongResponseBlock block in response)
            {
                Playable playable = PlayableFactory.CreatePlayable(block, m_DataModel);

                // If this stream is a part of the collection, use the database version
                // instead of the constructed one so we can display the user-set label.
                if (playable is AudioStream)
                {
                    AudioStream stream = m_DataModel.StreamsCollection.StreamByPath(playable.Path);

                    if (stream != null)
                    {
                        playable = stream;
                    }
                }

                contents.Add((LibraryItem)playable);
            }

            SavedPlaylist playlist = m_Playlists[name];

            m_PlaylistContents[playlist] = contents;
            IEnumerable <LibraryItem> selection = Items.SelectedItems();

            if (selection.Count() == 1 && ((AudioStream)selection.First()).Name == name)
            {
                NotifyPropertyChanged("ItemsOnSelectedPlaylist");
            }
        }
示例#2
0
 public void OnCurrentSongResponseReceived(IEnumerable <MPDSongResponseBlock> response)
 {
     if (response.Count() > 0)
     {
         Playable = PlayableFactory.CreatePlayable(response.First());
     }
 }
示例#3
0
        public void OnSearchResponseReceived(IEnumerable <MPDSongResponseBlock> response)
        {
            m_UnfilteredSearchResults.Clear();

            foreach (MPDSongResponseBlock item in response)
            {
                m_UnfilteredSearchResults.Add(PlayableFactory.CreatePlayable(item, m_DataModel) as LibraryItem);
            }

            FilterSearchResults();
        }