Ejemplo n.º 1
0
        public void DeleteMix(int mixId)
        {
            if (mixLookupDictionary.ContainsKey(mixId))
            {
                MixModel mixModel = mixLookupDictionary[mixId];

                Mixes.Remove(mixModel);
                mixLookupDictionary.Remove(mixId);
            }

            DatabaseManager.Current.DeleteMix(mixId);
        }
Ejemplo n.º 2
0
        public void AddMix(string name)
        {
            MixTable table = new MixTable(name, false, 0, MixSortOrder.None, false);

            DatabaseManager.Current.AddMix(table);

            MixModel mixModel = new MixModel(table);

            Mixes.Add(mixModel);
            mixLookupDictionary.Add(mixModel.MixId, mixModel);

            MixEntryTable entryTable = new MixEntryTable(mixModel.MixId, string.Empty, true, MixType.None);

            DatabaseManager.Current.AddMixEntry(entryTable);

            mixModel.AddEntry(entryTable);
        }
Ejemplo n.º 3
0
        private void LoadCollection()
        {
            PerfTracer perfTracer = new PerfTracer("LibraryModel Loading");

            IEnumerable <SongTable> allSongs = DatabaseManager.Current.FetchSongs();

            foreach (SongTable songEntry in allSongs)
            {
                SongModel songModel = new SongModel(songEntry);
                _allSongs.Add(songModel);
                songLookupDictionary.Add(songModel.SongId, songModel);
            }

            perfTracer.Trace("Songs Added");

            IEnumerable <AlbumTable> allAlbums = DatabaseManager.Current.FetchAlbums();

            foreach (AlbumTable albumEntry in allAlbums)
            {
                AlbumModel albumModel = new AlbumModel(albumEntry);
                _allAlbums.Add(albumModel);
                albumLookupDictionary.Add(albumModel.AlbumId, albumModel);
            }

            perfTracer.Trace("Albums Added");

            IEnumerable <ArtistTable> allArtists = DatabaseManager.Current.FetchArtists();

            foreach (ArtistTable artistEntry in allArtists)
            {
                ArtistModel artistModel = new ArtistModel(artistEntry);
                _allArtists.Add(artistModel);
                artistLookupDictionary.Add(artistModel.ArtistId, artistModel);
            }

            perfTracer.Trace("Artists Added");

            IEnumerable <PlaylistTable> allPlaylists = DatabaseManager.Current.FetchPlaylists();

            foreach (PlaylistTable playlistEntry in allPlaylists)
            {
                PlaylistModel playlistModel = new PlaylistModel(playlistEntry);
                Playlists.Add(playlistModel);
                playlistLookupDictionary.Add(playlistModel.PlaylistId, playlistModel);

                playlistModel.Populate();
            }

            perfTracer.Trace("Playlists Added");

            IEnumerable <MixTable> allMixes = DatabaseManager.Current.FetchMixes();

            foreach (MixTable mixEntry in allMixes)
            {
                MixModel mixModel = new MixModel(mixEntry);
                Mixes.Add(mixModel);
                mixLookupDictionary.Add(mixModel.MixId, mixModel);

                mixModel.Populate();
            }

            perfTracer.Trace("Mixes Added");
        }