예제 #1
0
        public void NotifyLoadStatus(LoadMoreStatus loadStatus)
        {
            switch (loadStatus)
            {
            case LoadMoreStatus.StausLoading:
                this.Footer = loadingPage;
                break;

            case LoadMoreStatus.StausNodata:
                this.Footer = nodataPage;
                break;

            case LoadMoreStatus.StausFail:
                this.Footer = failPage;
                break;

            case LoadMoreStatus.StausEnd:
                this.Footer = endPage;
                break;

            case LoadMoreStatus.StausError:
                this.Footer = errorPage;
                break;

            case LoadMoreStatus.StausNologin:
                this.Footer = nologinPage;
                break;

            default:
                this.Footer = null;
                break;
            }
        }
        public async Task <List <AnswersComments> > ReloadCommentsAsync()
        {
            LoadStatus = LoadMoreStatus.StausLoading;

            var result = await StoreManager.AnswersDetailsService.GetCommentAsync(answers.AnswerID);

            if (result.Success)
            {
                var comments = JsonConvert.DeserializeObject <List <AnswersComments> >(result.Message.ToString());
                if (comments.Count > 0)
                {
                    if (AnswersComments.Count > 0)
                    {
                        AnswersComments.Clear();
                    }
                    AnswersComments.AddRange(comments);
                    LoadStatus = LoadMoreStatus.StausEnd;
                }
                else
                {
                    LoadStatus = LoadMoreStatus.StausNodata;
                }
                CanLoadMore = false;
            }
            else
            {
                Crashes.TrackError(new Exception()
                {
                    Source = result.Message
                });
                LoadStatus = LoadMoreStatus.StausError;
            }
            return(AnswersComments);
        }
        public async Task <bool> DeleteAnswersCommentsAsync(int id)
        {
            var answersComments = AnswersComments.Where(n => n.CommentID == id).FirstOrDefault();
            var result          = await StoreManager.AnswersDetailsService.DeleteCommentAsync(answers.Qid, answers.AnswerID, answersComments.CommentID);

            if (result.Success)
            {
                var index = AnswersComments.IndexOf(answersComments);
                AnswersComments.RemoveAt(index);
                if (AnswersComments.Count == 0)
                {
                    LoadStatus = LoadMoreStatus.StausNodata;
                }
                AnswersDetails.CommentDisplay = (answers.CommentCounts = answers.CommentCounts - 1).ToString();
            }
            else
            {
                Crashes.TrackError(new Exception()
                {
                    Source = result.Message
                });
                Toast.SendToast("删除失败");
            }
            return(result.Success);
        }
예제 #4
0
        public void NotifyLoadStatus(LoadMoreStatus loadStatus)
        {
            switch (loadStatus)
            {
            case LoadMoreStatus.StatusDefault:
                this.Footer = null;
                break;

            case LoadMoreStatus.StatusLoading:
                this.Footer = LoadingContent;
                break;

            case LoadMoreStatus.StatusHasData:
                this.Footer = LoadMoreContent;
                break;

            case LoadMoreStatus.StatusNoData:
                this.Footer = NoDataContent;
                break;

            default:
                this.Footer = null;
                break;
            }
        }
        public void EditComment(AnswersComments comment)
        {
            var book = AnswersComments.Where(b => b.CommentID == comment.CommentID).FirstOrDefault();

            if (book == null)
            {
                AnswersComments.Add(comment);
                AnswersDetails.CommentDisplay = (answers.CommentCounts = answers.CommentCounts + 1).ToString();
            }
            else
            {
                var index = AnswersComments.IndexOf(book);
                AnswersComments[index] = comment;
            }
            if (LoadStatus == LoadMoreStatus.StausNodata)
            {
                LoadStatus = LoadMoreStatus.StausEnd;
            }
        }
예제 #6
0
 public async void NotifyLoadStatus(LoadMoreStatus loadStatus)
 {
     await this.InjectJavascriptAsync("updateLoadStatus(" + (int)loadStatus + ");");
 }