예제 #1
0
        /// <summary>
        /// Loads the required metadata such as genre, album for this file
        /// </summary>
        private void LoadMetaData()
        {
            if (!File.Exists(Location))
            {
                return;
            }

            // Get all the metadata for this file
            var(genre, artist, album, title) = DI.Get <IMetadataService>().GetMetaData(Location);

            // Initialize the properties with the metadata
            Genre  = (string.IsNullOrEmpty(genre) ? "Unknown Genre" : genre);
            Artist = (string.IsNullOrEmpty(artist) ? "Unknown Artist" : artist);
            Album  = (string.IsNullOrEmpty(album) ? "Unknown Album" : album);
            Title  = title;
        }
예제 #2
0
        /// <summary>
        /// Loads all the music files in the specified locations
        /// </summary>
        private async void LoadMusicFiles()
        {
            // Get all the music files in the different locations
            var list = await DI.Get <IDirectoryService>().GetMusicFilesFromAMultipleLocationsAsync(LocationsList);

            // Map each music file into MusicFileViewModel objects
            MusicFileList = new ObservableCollection <MusicFileViewModel>(await MapFilesToModelsAsync(list));

            // At least take one second when there is no music files, to make it more realistic
            if (MusicFileCount < 10)
            {
                await Task.Delay(2000);
            }

            // Load tag counters
            EverythingLoaded = await LoadTagCountsAsync();
        }