상속: BeatMachine.EchoNest.Model.Song, INotifyPropertyChanged, INotifyPropertyChanging
예제 #1
0
        public void GetSongsOnDevice(object state)
        {
            Dictionary<string, AnalyzedSong> uniqueSongs =
                new Dictionary<string, AnalyzedSong>();

            using (var mediaLib = new XnaMediaLibrary())
            {
                foreach (XnaSong s in mediaLib.Songs)
                {
                    string id = string.Concat(s.Artist.Name, s.Name)
                        .Replace(" ", "");
                    uniqueSongs[id] = new AnalyzedSong
                    {
                        ItemId = id,
                        ArtistName = s.Artist.Name,
                        SongName = s.Name
                    };

                }

                SongsOnDevice.AddRange(uniqueSongs.Values
                    .OrderBy(s => s.ArtistName)
                    .ThenBy(s => s.SongName));
            }

            SongsOnDeviceLoaded = true;
            logger.Info("Completed GetSongsOnDevice");
        }
예제 #2
0
        public static void GetSongsOnDevice(object state)
        {
            App thisApp = App.Current as App;
            List<AnalyzedSong> songs = thisApp.Model.SongsOnDevice;
            Dictionary<string, AnalyzedSong> uniqueSongs =
                new Dictionary<string, AnalyzedSong>();

            lock (songs)
            {
                using (var mediaLib = new XnaMediaLibrary())
                {
                    foreach(XnaSong s in mediaLib.Songs)
                    {
                        string id = string.Concat(s.Artist.Name, s.Name)
                            .Replace(" ", "");
                        uniqueSongs[id] = new AnalyzedSong
                        {
                            ItemId = id,
                            ArtistName = s.Artist.Name,
                            SongName = s.Name
                        };

                    }

                    songs.AddRange(uniqueSongs.Values
                        .OrderBy(s => s.ArtistName)
                        .ThenBy(s => s.SongName));
                }

                thisApp.Model.SongsOnDeviceLoaded = true;

            }
        }