Esempio n. 1
0
        //private async void loadLocalMessage()
        //{
        //    var listValues = GroupRepository.GetGroupMessagesForPageIndex(GroupObject.GroupId);

        //    if (listValues != null)
        //    {
        //        GroupchatMessageAdapter = new GroupMessageAdapter(this,ListChatsCon);
        //        mRecyclerView.SetAdapter(GroupchatMessageAdapter);
        //        GroupchatMessageAdapter.NotifyDataSetChanged();
        //        mRecyclerView.ScrollToPosition(GroupchatMessageAdapter.ItemCount - 1);
        //    }
        //}

        public void LoadLocalLatestMessages()
        {
            try
            {
                loadList = false;

                if (GroupObject != null)
                {
                    ListChatsCon = GroupRepository.GetGroupMessagesForPageIndex(paginationModel, GroupObject.GroupId);

                    if (ListChatsCon != null && ListChatsCon.Count > 0)
                    {
                        mAdapter = new GroupMessageAdapter(this, ListChatsCon);
                        mRecyclerView.SetAdapter(mAdapter);
                        mAdapter.NotifyDataSetChanged();
                        mRecyclerView.ScrollToPosition(mAdapter.ItemCount - 1);
                        loadList = true;
                    }
                }
            }
            catch (Exception e)
            {
                Crashes.TrackError(e);
            }
        }
Esempio n. 2
0
        public void LoadLocalPreviousMessages()
        {
            try
            {
                loadList = false;
                paginationModel.SkipRecords += 30;

                int PreviousListCount = ListChatsCon.Values.Sum(list => list.Count);
                ListChatsCon = GroupRepository.GetGroupMessagesForPageIndex(paginationModel, GroupObject.GroupId);
                int CurrentListCount = ListChatsCon.Values.Sum(list => list.Count);
                if (ListChatsCon != null && ListChatsCon.Count > 0)
                {
                    mAdapter = new GroupMessageAdapter(this, ListChatsCon);
                    mRecyclerView.SetAdapter(mAdapter);
                    mAdapter.NotifyDataSetChanged();
                    mRecyclerView.ScrollToPosition(CurrentListCount - PreviousListCount - 2);
                    loadList = true;
                }
            }
            catch (Exception e)
            {
                Crashes.TrackError(e);
            }
        }