最近整理电脑东西,虽然WP7已成过去式,记录下吧,代码是该别人的,增加委托传值,如得到获取数据的百分比等

正则抓取下厨房数据

下厨房正则
<span\s+itemprop="amount"> (?<title>.+?)</span><img\b[^<>]*?\bsrc[\s\t\r\n]*=[\s\t\r\n]*[""']?[\s\t\r\n]*(?<imgUrl>[^\s\t\r\n""'<>]*)[^<>]*?/?[\s\t\r\n]*> 图片<div\s+class="g-recipe-intro"\s+itemprop="summary">(?<title>.+?)</div>   介绍<em\s+itemprop="name">(?<title>.+?)</em>                 配料<div\s+class="g-recipe-steps"\s+itemprop="instructions">.+?<ol>.+?<li>(?<title>.+?)<br\s+class="clr"/>   第一步 <li>(?<title>.+?)<br\s+class="clr"/>.+?</li>                做法
<pre\s+class="g-recipe-tips\s+g-f14">(?<title>.+?)</pre>         小贴士豆果<span><a\s+href="/store/lists/c1t(?<url>.+?)">(?<title>.+?)</a></span>  菜系类型
<a\s+href="(?<Href>.+?)"\s+target="_blank"><img.+?src="(?<ImgUrl>.+?)"\s+alt="(?<Name>.+?)"></a>.+?<p>(?<Place>.+?)</p> 菜系详细
<h2>特色菜:</h2>.+?([<span>.+?</span>].+?)</div>   特色菜
<dt>电话:</dt>.+?<dd>(?<Phone>.+?)</dd>做法
<em>(?<num>.+?)</em>.+?<span>(?<title>.+?)</span>.+? <img\s+src="(?<src>.+?)"
<em>(?<num>.+?)</em>(?<title>.+?)<br\s+class="clr"/>         No Image
主料
itemprop="name"\s+title=.+?的做法">(?<title>.+?)<span\s+class="buy-price">
<a\s+href=.+?的做法"\s+itemprop="name">(?<title>.+?)</a>

分页

 public delegate void LazyListBoxHelperDelegateHandler(object obj);public class LazyListBoxHelper{static public int _pageIndex=0;static public bool _isBusy=true;//用于保存ListBox的ScrollViewer对象的引用static private ScrollViewer _scrollViewer = null;//用于判断是否已经捕捉ScrollViewerstatic private bool _isHookedScrollEvents = false;static public event LazyListBoxHelperDelegateHandler EventLazyListBoxHelperDelegateHandler;public static void InitLazyBox(Control LazyBox){List<ScrollBar> scrollBarList = GetVisualChildCollection<ScrollBar>(LazyBox);foreach (ScrollBar scrollBar in scrollBarList){if (scrollBar.Orientation == System.Windows.Controls.Orientation.Horizontal){}else{scrollBar.ValueChanged += verticalScrollBar_ValueChanged;}}}#region  分页调用方法/// <summary>  /// 分页  /// </summary>  /// <param name="sender"></param>  /// <param name="e"></param>  private static void verticalScrollBar_ValueChanged(object sender, RoutedEventArgs e){ScrollBar scrollBar = (ScrollBar)sender;object valueObj = scrollBar.GetValue(ScrollBar.ValueProperty);object maxObj = scrollBar.GetValue(ScrollBar.MaximumProperty);if (valueObj != null && maxObj != null){double value = (double)valueObj;double max = (double)maxObj - 1.0;if (value >= max){if (EventLazyListBoxHelperDelegateHandler != null){EventLazyListBoxHelperDelegateHandler(max);}}}}public static List<T> GetVisualChildCollection<T>(object parent) where T : UIElement{List<T> visualCollection = new List<T>();GetVisualChildCollection(parent as DependencyObject, visualCollection);return visualCollection;}public static void GetVisualChildCollection<T>(DependencyObject parent, List<T> visualCollection) where T : UIElement{int count = VisualTreeHelper.GetChildrenCount(parent);for (int i = 0; i < count; i++){DependencyObject child = VisualTreeHelper.GetChild(parent, i);if (child is T){visualCollection.Add(child as T);}else if (child != null){GetVisualChildCollection(child, visualCollection);}}}#endregion/// <summary>  ///获取控件的子控件  /// </summary>  /// <typeparam name="T">子控件类</typeparam>  /// <param name="root">父控件</param>  /// <returns></returns>  public static T FindChildOfType<T>(DependencyObject root) where T : class{var queue = new Queue<DependencyObject>();queue.Enqueue(root);while (queue.Count > 0){DependencyObject current = queue.Dequeue();for (int i = VisualTreeHelper.GetChildrenCount(current) - 1; 0 <= i; i--){var child = VisualTreeHelper.GetChild(current, i);var typedChild = child as T;if (typedChild != null){return typedChild;}queue.Enqueue(child);}}return null;}/// <summary>  /// 高敏感翻页  /// </summary>  public static bool HightDragSensitivity{get{return false;}}}

调用如果需要返回当前状态值,订阅Event事件即可

LazyListBoxHelper.EventLazyListBoxHelperDelegateHandler += (args) =>{WebClient client = new WebClient();if (!client.IsBusy && LazyListBoxHelper._isBusy){LazyListBoxHelper._isBusy = false;LazyListBoxHelper._pageIndex += 20;this.progressBar.IsIndeterminate = true;this.progressBar.Visibility = Visibility.Visible;client.DownloadStringCompleted += (s, e) =>{if (e.Error == null){List<FindLinkInfo> list = GetFoodDetail(e.Result);for (int i = 0; i < list.Count; i++){this.ListFindData.Items.Add(list[i]);}LazyListBoxHelper._isBusy = true;}this.progressBar.IsIndeterminate = false;this.progressBar.Visibility = Visibility.Collapsed;};client.DownloadStringAsync(new Uri(String.Format(@"http://www.douguo.com/store/lists/c1t/{0}{1}", (this.listFindTitle.SelectedItem as FindLinkInfo).Url, LazyListBoxHelper._pageIndex), UriKind.Absolute));}};LazyListBoxHelper.InitLazyBox(ListFindData);}private void IninHot(){//检查网路if (NetworkInterface.GetIsNetworkAvailable()){

LazyListBoxHelper 动态分页相关推荐

  1. php 动态分页,PHP动态分页函数,PHP开发分页必备啦

    PHP动态分页函数,PHP开发分页必备啦发布:mdxy-dxy 字体:[增加 减小] 类型:转载 PHP动态分页函数,PHP开发分页必备啦.其实吧,这个是必用的,不说了,PHP动态分页函数还是不错,比 ...

  2. jpa mysql sql分页查询语句_JPA多条件复杂SQL动态分页查询功能

    概述 ORM映射为我们带来便利的同时,也失去了较大灵活性,如果SQL较复杂,要进行动态查询,那必定是一件头疼的事情(也可能是lz还没发现好的方法),记录下自己用的三种复杂查询方式. 环境 spring ...

  3. 使用pagination分页插件实现Ajax动态分页

    pagination插件下载地址:https://pan.baidu.com/s/1c3QQ7XQ 一.前言 做的一个列表页要将所有结果显示出来,太多记录不能一次性显示,所以要进行分页.一开始尝试自己 ...

  4. Mybatis+MySQL动态分页查询数据经典案例

    最近在用Mybatis做项目的时候遇到了不少问题,今天我就在这和大家分享一下,稀稀拉拉的研究了两天,终于搞好了! 开发人员:1111 开发软件:Myeclipse 用到的框架技术:Mybatis 数据 ...

  5. Mybatis+mysql动态分页查询数据案例——房屋信息的接口(IHouseDao)

    package cn.bdqn.mhouse.dao;import java.util.List;import cn.bdqn.mhouse.entity.House; import cn.bdqn. ...

  6. Mybatis+MySQL动态分页查询数据经典案例(含代码以及测试)

    最近在用Mybatis做项目的时候遇到了不少问题,今天我就在这和大家分享一下,稀稀拉拉的研究了两天,终于搞好了! 开发人员:1111 开发软件:Myeclipse 用到的框架技术:Mybatis 数据 ...

  7. 不用ajax实现动态分页,详解ajax +jtemplate实现动态分页

    jtemplate是一个基于JQuery的模板引擎插件,功能非常强大,有了她你就再不用为使用JS绑定数据集而发愁了. 主要思路,复制textarea作为模板,ajax加载json数据,添加模板,绑定数 ...

  8. 基于SpringDataJpa的mysql动态分页多表查询

    基于SpringDataJpa的mysql动态分页多表查询 由于这篇文章预计篇幅会很长,关于Spring Data JPA的知识就简短的分享,更多的请自行度娘,JPA 封装了很多查询的接口,但今天要讲 ...

  9. 动态分页展示效果(纯JavaScript编写,值得学习)

    动态分页展示效果(纯JavaScript编写,值得学习) <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN&q ...

最新文章

  1. cd: mkdir: rmdir: rm
  2. java类的两个基本成分_Java类文件的基本结构
  3. caffe学习笔记19-batchsize参数
  4. centos 删除crontab_CentOS安装crontab及使用方法
  5. 2019牛客暑期多校训练营(第十场)C - Gifted Composer (二分+哈希)
  6. 【无码专区4】幸运数字4(折半搜索+计数+结论)
  7. python调用dll函数_关于从加载的DLL调用函数的Python基本问题
  8. html里面Meta标签的使用
  9. 吴恩达机器学习学习笔记第一章:绪论初识机器学习
  10. servlet ---- 响应对象
  11. 小爱同学app安卓版_小爱同学app下载安卓版-小爱同学 安卓版v2.9.42-pc6手机下载...
  12. word2vec模型原理及实现词向量训练案例
  13. Nacos注册中心AP架构源码(Distro)上篇
  14. Xaml技术:浅析为什么说一个标签就是new一个对象?
  15. 淘宝/天猫API:item_recommend-获取推荐商品列表
  16. 推荐印度电影《起跑线》,让家长加入观影一点不为过
  17. 单元测试探析:什么是Stubs、Mocks、Spies、Dummies?带你了解4个核心工具
  18. 索氏提取器使用注意_索氏提取器的使用方法
  19. Cocos2d-x 2.0 网格动画深入分析
  20. c语言创建文件存放,C语言文件操作

热门文章

  1. python安装whl_EN-mysqlclient库安装问题
  2. 计算机辅助教学 林筑英,视频教学制作技巧.doc
  3. 天翼云从业认证(3.2)天翼云存储产品
  4. 笔记-信息系统开发基础-软件工程-评审与审计
  5. 笔记-项目立项管理-项目的可行性研究-可行性研究内容
  6. 项目管理中的客户需求变更时需求分析和解决方法
  7. Android中通过自定义签名控件实现手写签名
  8. SpringBoot+ElementUI实现多选设置一月中指定几天的属性,SpringBoot中通过反射实现
  9. jsp中通过多种方式实现面包屑导航
  10. 三、链表(Linked List)(原理)