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 提示信息
            }
        }
Ejemplo n.º 2
0
        protected override async void SetById(long id)
        {
            var innerMvdataResult = await this._netWorkServices.GetAsync <Mv>("Common", "GetMvById", new { id });

            if (!innerMvdataResult.Successed)
            {
                //todo 网络连接四百
                return;
            }
            _innerMv = innerMvdataResult.Data;
            var task1 = _netWorkServices.GetAsync <CommentCollection>("Common", "GetCommentById", new { commentThreadId = _innerMv.CommendThreadId });
            var task2 = _netWorkServices.GetAsync <Mv[]>("Common", "GetSimiMv", new { id });
            await Task.WhenAll(task1, task2);

            if (task1.Result.Successed && task2.Result.Successed)
            {
                _innerComment = task1.Result.Data;
                await Task.WhenAll(
                    NewComments.AddRangeAsync(_innerComment.Comments),
                    HotComments.AddRangeAsync(_innerComment.HotComments),
                    SimiMvs.AddRangeAsync(task2.Result.Data));

                this._currentPage = 1;
                RaiseAllPropertyChanged();
                RefreshCompleated?.Invoke(this, EventArgs.Empty);
            }
            else
            {
                //todo 网络连接四百
            }
        }
Ejemplo n.º 3
0
        private async void OnCurrentPageChanged()
        {
            var temp = await _netWorkServices.GetAsync <CommentCollection>("Common", "GetCommentById", new
            {
                commentThreadId = _innerMv.CommendThreadId,
                offset          = (CurrentPage - 1) * Settings.Default.LimitPerPage,
                limit           = Settings.Default.LimitPerPage
            });

            if (temp.Successed)
            {
                _innerComment = temp.Data;
                await Task.WhenAll(
                    NewComments.AddRangeAsync(_innerComment.Comments),
                    HotComments.AddRangeAsync(_innerComment.HotComments)
                    );
            }
        }
Ejemplo n.º 4
0
        /// <summary>
        /// 当当前页发生变化的时候,刷新
        /// </summary>
        private async void OnCurrentPageChanged()
        {
            if (this._innerComment.More)
            {
                var ccDataResult = await this._netWorkServices.GetAsync <CommentCollection>("Common", "GetCommentById", new
                {
                    commentThreadId = $"R_SO_4_{Id}",
                    offset          = ((int)CurrentPage - 1) * Settings.Default.LimitPerPage,
                    limit           = Settings.Default.LimitPerPage
                });

                if (ccDataResult.Successed)
                {
                    this._innerComment = ccDataResult.Data;
                    await Task.WhenAll(NewComments.AddRangeAsync(this._innerComment.Comments),
                                       HotComments.AddRangeAsync(this._innerComment.HotComments));

                    // RaiseAllPropertyChanged();
                }
            }
        }