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 网络连接四百 } }
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) ); } }