Ejemplo n.º 1
0
        protected override async void SetById(long id)
        {
            var task1 = this._netWorkServices.GetAsync <Music>("Music", "GetMusicDetailById", new { id });
            var task2 = this._netWorkServices.GetAsync <List <Music> >("Music", "GetSimiMusic", new { id });
            var task3 = this._netWorkServices.GetAsync <CommentCollection>("Common", "GetCommentById", new { commentThreadId = $"R_SO_4_{id}" });
            var task4 = this._netWorkServices.GetAsync <List <Lyric> >("Music", "GetLyricByMusicId", new { id });
            var task5 = this._netWorkServices.GetAsync <PlayList[]>("Music", "GetSimiPlayList", new { id });
            await Task.WhenAll(task1, task2, task3, task4, task5);

            if (task1.Result.Successed &&
                task2.Result.Successed &&
                task3.Result.Successed &&
                task4.Result.Successed &&
                task5.Result.Successed)
            {
                this._innerMusic   = task1.Result.Data;
                this._innerComment = task3.Result.Data;
                await Task.WhenAll(
                    Artists.AddRangeAsync(this._innerMusic.Artists),
                    SimiMusics.AddRangeAsync(task2.Result.Data),
                    NewComments.AddRangeAsync(this._innerComment.Comments),
                    HotComments.AddRangeAsync(this._innerComment.HotComments),
                    Lryics.AddRangeAsync(task4.Result.Data),
                    ContainsThisTrackList.AddRangeAsync(task5.Result.Data));

                this._currentPage = 1;
                RaiseAllPropertyChanged();
            }
            else
            {
                //todo 提示信息
            }
        }