예제 #1
0
        private async void Page_Loaded(object sender, RoutedEventArgs e)
        {
            GetSongButton.Visibility = Visibility.Collapsed;
            SongList.Clear();
            var songs = await SongManager.GetSongsAsync(AlbumsList);

            songs.ForEach(i => SongList.Add(i));
            CoolDownStart();
        }
        private void PopulateSongList(Concert concert)
        {
            SongList.Clear();
            var temp = QueryManager.GetSongsByConcertId(concert.ConcertId);

            for (int i = 0; i < temp.Count; i++)
            {
                SongList.Add(temp[i]);
            }
        }
        public async Task GetSongs()
        {
            var songList = await _songService.GetById <IEnumerable <SongGetRequest> >(Album.Id, "GetSongsByAlbum");

            SongList.Clear();
            foreach (var item in songList)
            {
                SongList.Add(item);
            }
        }
        protected override void UpdateSongList()
        {
            List <string> songs = new List <string>();

            ScanMemory(songs);
            SongList.Clear();
            foreach (var i in songs)
            {
                SongList.Add(AudioParams.GetParam(i));
                musicDatabase.CreateTrack(AudioParams.GetParam(i));
            }
        }
예제 #5
0
        private async void GetSongButton_Click(object sender, RoutedEventArgs e)
        {
            SongList.Clear();
            ClearSongInfo();
            GameDescTextBlock.Text = string.Empty;
            _roundNum = 0;
            _ttlScore = 0;
            GetSongButton.Visibility = Visibility.Collapsed;
            var songs = await SongManager.GetSongsAsync(AlbumsList);

            songs.ForEach(i => SongList.Add(i));
            CoolDownStart();
        }
예제 #6
0
        public void LoadSongList()
        {
            var paths = SongListOperator.Instance.LoadDirectorySongList();

            SongList.Clear();
            for (int i = 0; i < paths.Count; i++)
            {
                Song song = new Song(paths[i]);
                SongList.Add(song);
                if (i % 10 == 0)
                {
                    SongListViewModel.InitialSongList(SongList);
                }
            }
        }
예제 #7
0
        public async Task LoadSongs()
        {
            SongList.Clear();

            var request = new Model.Requests.SongsSearchRequest
            {
                AlbumId = AlbumId,
                Filter  = (int)ReviewStatus.Approved
            };
            var list = await _serviceSongs.Get <List <Model.Songs> >(request);

            foreach (var item in list)
            {
                SongList.Add(item);
            }
        }
        public async Task GetSongsAsync(AlbumViewModel a)
        {
            Album = a;
            await a.GetSongsAsync();

            await CoreApplication.MainView.Dispatcher.RunAsync(Windows.UI.Core.CoreDispatcherPriority.High, () =>
            {
                SongList.Clear();
                for (int i = 0; i < a.Songs.Count; i++)
                {
                    SongList.Add(new SongViewModel(a.Songs[i])
                    {
                        Index = (uint)i
                    });
                }
                foreach (var item in SongList)
                {
                    item.RefreshFav();
                }
            });

            var info = await MainPageViewModel.Current.GetAlbumInfoAsync(Album.Name, Album.AlbumArtists.FirstOrDefault());

            await CoreApplication.MainView.Dispatcher.RunAsync(Windows.UI.Core.CoreDispatcherPriority.High, () =>
            {
                if (info != null)
                {
                    if (Album.Artwork == null && info.AltArtwork != null)
                    {
                        Album.ArtworkUri = info.AltArtwork;
                        var task         = ThreadPool.RunAsync(async k =>
                        {
                            if (!Album.IsOnline)
                            {
                                await SQLOperator.Current().UpdateAlbumArtworkAsync(album.ID, info.AltArtwork.OriginalString);
                            }
                        });
                    }
                    Album.Description = info.Description;
                }
                else
                {
                    Album.Description = $"# {Consts.Localizer.GetString("LocaAlbumTitle")}";
                }
            });
        }
예제 #9
0
        public async Task GetSongsAsync(AlbumViewModel a)
        {
            Album = a;
            await a.GetSongsAsync();

            await CoreApplication.MainView.Dispatcher.RunAsync(Windows.UI.Core.CoreDispatcherPriority.High, () =>
            {
                SongList.Clear();

                var songViewmodels = new List <SongViewModel>();

                for (int i = 0; i < a.Songs.Count; i++)
                {
                    songViewmodels.Add(new SongViewModel(a.Songs[i])
                    {
                        Index = (uint)i
                    });
                }

                var group = GroupedItem <SongViewModel> .CreateGroups(songViewmodels, s => s.Disc);

                foreach (var item in group)
                {
                    var ordered = item.OrderBy(s => s.Track).ToList();
                    item.Clear();
                    foreach (var o in ordered)
                    {
                        item.Add(o);
                    }
                    SongList.Add(item);
                }

                Task.Run(async() =>
                {
                    var favors = await SQLOperator.Current().GetFavoriteAsync();
                    await CoreApplication.MainView.Dispatcher.RunAsync(Windows.UI.Core.CoreDispatcherPriority.High, () =>
                    {
                        foreach (var disc in SongList)
                        {
                            foreach (var song in disc)
                            {
                                if (favors.Contains(song.ID))
                                {
                                    if (favors.Count == 0)
                                    {
                                        return;
                                    }
                                    song.Favorite = true;
                                    favors.Remove(song.ID);
                                }
                            }
                        }
                    });
                });
            });

            AlbumInfo info = null;

            try
            {
                if (Album.Name != null)
                {
                    info = await MainPageViewModel.Current.GetAlbumInfoAsync(Album.Name, Album.AlbumArtists?.FirstOrDefault());
                }
            }
            catch (Exception)
            {
            }
            await CoreApplication.MainView.Dispatcher.RunAsync(Windows.UI.Core.CoreDispatcherPriority.High, () =>
            {
                if (info != null)
                {
                    if (Album.ArtworkUri == null && info.AltArtwork != null)
                    {
                        Album.ArtworkUri = info.AltArtwork;
                        var task         = ThreadPool.RunAsync(async k =>
                        {
                            if (!Album.IsOnline)
                            {
                                await SQLOperator.Current().UpdateAlbumArtworkAsync(album.ID, info.AltArtwork.OriginalString);
                            }
                        });
                    }
                    Album.Description = info.Description;
                }
                else
                {
                    Album.Description = $"# {Consts.Localizer.GetString("LocaAlbumTitle")}";
                }
            });
        }