public async void GetData(int pageIndex, string url) { try { if (IsLoading) { return; } IsLoading = true; if (PageCount != -1 && pageIndex > PageCount) { return; } if (string.IsNullOrEmpty(url)) { return; } PageIndex = pageIndex; if (pageIndex > 1) { url = url.Insert(url.Length - 5, "_" + pageIndex); } var html = await GetHtmlData(url, false, true); var list = ListPageDataHelper.GetBookUpdateChapterList(html); if (list == null) { Debug.WriteLine("更新列表数据获取失败"); } else { var match = Regex.Match(html, @"(?<=总计.*?记录.*?共).*?(?=页)"); if (match != null) { try { PageCount = Convert.ToInt32(match.ToString().Trim()); } catch (Exception) { PageCount = 1; } } if (pageIndex == 1) { Books.Clear(); foreach (var item in list) { item.BookName = CurrentBook.BookName; item.BookId = CurrentBook.BookId; Books.Add(item); } } else { foreach (var item in list) { item.BookName = CurrentBook.BookName; item.BookId = CurrentBook.BookId; Books.Add(item); } } Title = $"{CurrentBook.BookName}({PageIndex}/{PageCount})"; } } catch (Exception ex) { Debug.WriteLine(ex.Message + "\n" + ex.StackTrace); throw; } finally { await Task.Delay(100); IsLoading = false; } }