Esempio n. 1
0
        public async void Update()
        {
            IsLoading = true;

            TotalComments      = _se.Comments;
            TotalLongComments  = _se.LongComments;
            TotalShortComments = _se.ShortComments;

            var t1 = _api.GetShortComments(_story_id);
            var t2 = _api.GetLongComments(_story_id);

            List <StoryComment> short_comments = await t1;
            List <StoryComment> long_comments  = await t2;

            if (short_comments != null && short_comments.Any())
            {
                StoryCommentsIncrementalLoadingCollection c = new StoryCommentsIncrementalLoadingCollection(short_comments.Last().ID, _story_id, true);
                short_comments.ForEach((comment) => { c.Add(comment); });

                ShortComments = c;

                c.DataLoaded  += C_DataLoaded;
                c.DataLoading += C_DataLoading;
            }
            if (long_comments != null && long_comments.Any())
            {
                StoryCommentsIncrementalLoadingCollection c = new StoryCommentsIncrementalLoadingCollection(long_comments.Last().ID, _story_id, false);
                long_comments.ForEach((comment) => { c.Add(comment); });

                LongComments = c;

                c.DataLoaded  += C_DataLoaded;
                c.DataLoading += C_DataLoading;
            }

            IsLoading = false;
        }
        public async void Update()
        {

            IsLoading = true;

            TotalComments = _se.Comments;
            TotalLongComments = _se.LongComments;
            TotalShortComments = _se.ShortComments;

            var t1 = _api.GetShortComments(_story_id);
            var t2 = _api.GetLongComments(_story_id);

            List<StoryComment> short_comments = await t1;
            List<StoryComment> long_comments = await t2;

            if (short_comments != null && short_comments.Any())
            {
                StoryCommentsIncrementalLoadingCollection c = new StoryCommentsIncrementalLoadingCollection(short_comments.Last().ID, _story_id, true);
                short_comments.ForEach((comment) => { c.Add(comment); });

                ShortComments = c;

                c.DataLoaded += C_DataLoaded;
                c.DataLoading += C_DataLoading;
            }
            if (long_comments != null && long_comments.Any())
            {
                StoryCommentsIncrementalLoadingCollection c = new StoryCommentsIncrementalLoadingCollection(long_comments.Last().ID, _story_id, false);
                long_comments.ForEach((comment) => { c.Add(comment); });

                LongComments = c;

                c.DataLoaded += C_DataLoaded;
                c.DataLoading += C_DataLoading;
            }

            IsLoading = false;
        }