コード例 #1
0
        public void ArticalOverviewProcessedCallback(string uid, string url, ArticalOverview[] articalOverviews, OverviewType overviewType, string nextPageUrl)
        {
            ArticalOverview[] newData = null;
            lock (NextPageRequestUids)
            {
                if (NextPageRequestUids == uid)
                {
                    newData = new ArticalOverview[adapter.data.Length + articalOverviews.Length];
                    adapter.data.CopyTo(newData, 0);
                    articalOverviews.CopyTo(newData, adapter.data.Length);

                    NextPageRequestUids = string.Empty;
                }
            }
            if (nextPageUrl != null && nextPageUrl != string.Empty)
            {
                nextPageContext = new NextPageContext()
                {
                    overviewType = overviewType, url = nextPageUrl
                };                                                                                          //save the next page state
            }

            if (uid == refreshingRequestUid)
            {
                newData = null;
                refreshingRequestUid = string.Empty;
                RunOnUiThread(new Action(() => { swipeRefLayout.Refreshing = false; }));
            }

            adapter.data = newData == null ? articalOverviews : newData;
            database.IsSeen(UidGenerator(), adapter.data);  //request a filter from DB
            RunOnUiThread(responseUpdate);
        }
コード例 #2
0
        public void ArticalOverviewProcessedCallback(string uid, string url, ArticalOverview[] articalOverviews, OverviewType overviewType, string nextPageUrl)
        {
            MyLog.Log(this, nameof(ArticalOverviewProcessedCallback));
            ArticalOverview[] newData = null;
            lock (NextPageRequestUids)
            {
                if (NextPageRequestUids == uid)
                {
                    MyLog.Log(this, $"next page data received" + "...");
                    newData = new ArticalOverview[adapter.data.Length + articalOverviews.Length];
                    adapter.data.CopyTo(newData, 0);
                    articalOverviews.CopyTo(newData, adapter.data.Length);

                    NextPageRequestUids = string.Empty;
                    MyLog.Log(this, $"next page data received" + "...Done");
                }
            }
            if (nextPageUrl != null && nextPageUrl != string.Empty)
            {
                nextPageContext = new NextPageContext()
                {
                    overviewType = overviewType, url = nextPageUrl
                };                                                                                          //save the next page state
            }

            if (uid == refreshingRequestUid)
            {
                MyLog.Log(this, "refreshing content received" + "...");
                newData = null;
                refreshingRequestUid = string.Empty;
                Activity.RunOnUiThread(new Action(() => { swipeRefLayout.Refreshing = false; }));
                MyLog.Log(this, "refreshing content received" + "...Done");
            }

            MyLog.Log(this, "Updating adapter data" + "...");
            adapter.data = newData == null ? articalOverviews : newData;
            database.IsSeen(UidGenerator(), adapter.data);  //request a filter from DB
            Activity.RunOnUiThread(responseUpdate);
            MyLog.Log(this, "Updating adapter data" + "...Done");
            MyLog.Log(this, nameof(ArticalOverviewProcessedCallback) + "...Done");
        }