private void CheckQuestPage(NameValueCollection req, getmember_questlist api) { int checkfrom, checkto; int type = req.GetInt("api_tab_id"); CycleCount(); if (api.api_list == null) { if (api.api_disp_page == 1) { AvilableQuests.Clear(); } OnAllPropertyChanged(); return; } checkfrom = api.api_list.First().api_no; checkto = api.api_list.Last().api_no; if (api.api_disp_page == 1) { checkfrom = int.MinValue; } else if (lastcheckedpage == api.api_disp_page - 1) { checkfrom = lastcheckedto + 1; } if (api.api_disp_page == api.api_page_count) { checkto = int.MaxValue; } else if (lastcheckedpage == api.api_disp_page + 1) { checkto = lastcheckedfrom - 1; } IEnumerable <Quest> checkremovelist = null; switch (type) { case 0: checkremovelist = AvilableQuests; break; case 1: checkremovelist = AvilableQuests.Where(x => x.Period == QuestPeriod.Daily); break; case 2: checkremovelist = AvilableQuests.Where(x => x.Period == QuestPeriod.Weekly); break; case 3: checkremovelist = AvilableQuests.Where(x => x.Period == QuestPeriod.Monthly); break; case 4: checkremovelist = AvilableQuests.Where(x => x.Period == QuestPeriod.Once); break; } if (checkremovelist != null) { foreach (var item in checkremovelist.Where(x => x.Id >= checkfrom && x.Id <= checkto).ToList()) { AvilableQuests.Remove(item); } } AvilableQuests.UpdateWithoutRemove(api.api_list, x => x.api_no); AvilableCount = api.api_count; InProgressCount = api.api_exec_count; lastcheckedpage = api.api_disp_page; lastcheckedfrom = checkfrom; lastcheckedto = checkto; lastcheckedtime = DateTimeOffset.UtcNow.ToOffset(QuestUpdateTime); UpdateInProgress(); OnAllPropertyChanged(); }