示例#1
0
        public async void GetInfo(ISong song, Action action)
        {
            SongInfoContent content = await ServiceProvider.GetService <ISongService>().GetInfoAsync(song.SongId);

            if (!content.HasError)
            {
                this.Song       = content.Item;
                this.PictureUrl = this.Song.PictureBig;
            }

            action();
        }
示例#2
0
        async static void GetSongInfo(ISong song, ManualResetEvent resetEvent)
        {
            ServiceProvider serviceProvider = ApplicationContent.Instance.Injector.Resolve <ServiceProvider>();

            if (serviceProvider != null)
            {
                ISongService    songService = serviceProvider.GetService <ISongService>();
                SongInfoContent content     = await songService.GetInfoAsync(song.SongId);

                song.CopyFrom(content.Item);
            }

            resetEvent.Set();
        }
        public async Task StepByStep()
        {
            BaiduRestService.GetService(this.Client.RestClient).Responsed += BaiduSongListServiceTest_Responsed;
            SongListContent songlistContent = await BaiduSongListService.GetService(this.Client).GedanAsync(1);

            foreach (var songlist in songlistContent.SongLists)
            {
                SongListInfoContent songlistInfoContent = await BaiduSongListService.GetService(this.Client).GedanInfoAsync(songlist.ListId);

                foreach (var song in songlistInfoContent.Songs)
                {
                    SongInfoContent songInfoContent = await BaiduSongService.GetService(this.Client).GetInfoAsync(song.SongId);

                    song.CopyFrom(songInfoContent.Item);
                }
            }
            BaiduRestService.GetService(this.Client.RestClient).Responsed -= BaiduSongListServiceTest_Responsed;
        }