示例#1
0
        public async override void Execute(object parameter)
        {
            MusicLibraryViewModel.AlbumItem album = parameter as MusicLibraryViewModel.AlbumItem;
            Locator.MusicPlayerVM.TrackCollection.ResetCollection();
            Locator.MusicPlayerVM.TrackCollection.AddTrack(album.Tracks.ToList());
            await Locator.MusicPlayerVM.Play();

            var frame = App.ApplicationFrame;

            #if NETFX_CORE
            var page = frame.Content as Views.MainPage;
            #endif
            #if WINDOWS_PHONE_APP
            var page = frame.Content as VLC_WINPRT.Views.MainPage;
            #endif
            if (page != null)
            {
                var sB = page.Resources["FadeOutPage"] as Storyboard;
                if (sB != null)
                {
                    #if NETFX_CORE
                    await sB.BeginAsync();

                    NavigationService.NavigateTo(typeof(PlayMusic));
                    #endif
                }
            }
        }
        public async static Task <MusicLibraryViewModel.AlbumItem> GetAlbumItemFromFolder(StorageFolder item, StorageFolderQueryResult albumQueryResult, int artistId)
        {
            var albumDataRepository = new AlbumDataRepository();
            var musicAttr           = await item.Properties.GetMusicPropertiesAsync();

            var albumItem = await albumDataRepository.LoadAlbumViaName(artistId, musicAttr.Album);

            if (albumItem == null)
            {
                var thumbnail = await item.GetThumbnailAsync(ThumbnailMode.MusicView, 250);

                albumItem = new MusicLibraryViewModel.AlbumItem(thumbnail, musicAttr.Album, albumQueryResult.Folder.DisplayName)
                {
                    ArtistId = artistId
                };
                await albumDataRepository.Add(albumItem);
            }
            var files = await item.GetFilesAsync(CommonFileQuery.OrderByMusicProperties);

            await albumItem.LoadTracks(files);

            return(albumItem);
        }
示例#3
0
        public Task Add(MusicLibraryViewModel.AlbumItem album)
        {
            var connection = new SQLiteAsyncConnection(_dbPath);

            return(connection.InsertAsync(album));
        }