Exemple #1
0
        private void CommentList_ItemClick(object sender, ItemClickEventArgs e)
        {
            HSComment HSC = ( HSComment )e.ClickedItem;

            if (HSC.Folded)
            {
                if (HSC == HSComment.ActiveInstance)
                {
                    return;
                }
                int i = CommentsSource.IndexOf(HSC);

                // The Load more always appeared in the next level
                // i.e. previous item is always a parent
                HSComment ParentHSC = CommentsSource[i - 1];

                HSLoader <HSComment> CLoader = new HSLoader <HSComment>(ParentHSC.Id, SHTarget.COMMENT, Shared.ShRequest.GetComments)
                {
                    ConvertResult = (x) =>
                                    x.Flattern(y =>
                    {
                        y.Level += HSC.Level;
                        return(y.Replies);
                    })
                };

                CommentsSource.LoadStart += (x, y) => MarkLoading();
                CommentsSource.LoadEnd   += (x, y) => MarkNotLoading();

                // Remove the LoadMore thing
                CommentsSource.RemoveAt(i);
                CommentsSource.InsertLoader(i, CLoader);

                // Load it or else will only be triggered when pgae reads bottom
                var j = CommentsSource.LoadMoreItemsAsync(20);
            }

            HSC.MarkSelect();
        }