Beispiel #1
0
        private async void GetAnswerDetail()
        {
            if (null == _answerService || _isDetailLoaded)
            {
                return;
            }

            Loading = true;

            var result = await _answerService.GetAnswerDetailAsync(LoginUser.Current.Token, AnswerId, true);

            Loading = false;

            if (null != result.Error)
            {
                ToasteIndicator.Instance.Show(String.Empty, result.Error.Message, null, 3);

                Debug.WriteLine(Regex.Unescape(result.Error.Message));
                return;
            }

            _isDetailLoaded = true;

            if (result.Result.SuggestEdit != null && result.Result.SuggestEdit.Status &&
                String.IsNullOrEmpty(result.Result.Content))
            {
                result.Result.Content = result.Result.SuggestEdit.Reason;
            }

            Detail = result.Result;
        }
        private async Task OfflineAnswer(Int32 answerid)
        {
            if (null == _answer)
            {
                return;
            }

            var detailTask   = _answer.GetAnswerDetailAsync(LoginUser.Current.Token, answerid, true);
            var relationTask = _answer.GetAnswerRelationshipAsync(LoginUser.Current.Token, answerid, true);
            var favoriteTask = _answer.CheckFavoriteAsync(LoginUser.Current.Token, answerid, true);

            var commentsTask = OfflineAnswerComments(answerid);

            await detailTask;
            await relationTask;
            await favoriteTask;
            await commentsTask;

            lock (_answersSync)
            {
                AnswersCount++;
            }
        }