业务流程图

优化前后对比:

优化过程:

1. 界面刷新,特别是表格刷新

把ListView.DataContext  = DataSet 这些代码替换成以下:

        public static void SetDataSource(ListView lv, DataSet ds)
{
DataSet preds = (DataSet)lv.DataContext;
if (preds == null) // first set datacontext
{
preds = ds;
lv.DataContext = preds;
}
else // reset data context, we don't change the datacontext object , but change data rows
{
DataTable tb = preds.Tables[0];
tb.Clear();
tb.Dispose();
foreach (DataRow dr in ds.Tables[0].Rows)
{
tb.ImportRow(dr);
}
lv.DataContext = preds;
ds.Dispose();
ds = null;
}
} public static void AddDataRowToDataSource(ListView lv, DataRow dr)
{
DataSet ds = (DataSet)lv.DataContext;
if (ds == null)
{
return;
}
else
{
DataTable tb = ds.Tables[0];
tb.ImportRow(dr);
lv.DataContext = ds;
}
}

  2. 尽量减少 new 的使用

最新文章

  1. word
  2. c语言中类型隐性转换的坑
  3. href链接的地址
  4. [tp3.2.1]查询(2)
  5. matlab 函数说明--waitforbuttonpress
  6. [转]将某个Qt4项目升级到Qt5遇到的问题
  7. python核心编程-第五章-个人笔记
  8. DDD分层架构之值对象(介绍篇)
  9. Linux_服务器_01_查看公网IP
  10. 关于pocsuite的使用
  11. 在Android studio模拟器中运行apk文件
  12. 关于library cache lock和row cache lock产生的常见原因
  13. 电商门户网站商品品类多级联动SpringBoot+Thymeleaf实现
  14. 使用 idea 产生错误The server time zone value 'Öйú±ê׼ʱ¼ä' is unrecognized
  15. scrapy的Middleware
  16. Codeforces Round #512 E - Vasya and Good Sequences
  17. MyBatis基础入门《十八》动态SQL(if-where)
  18. BroadcastReceiver(广播)的静态注册和动态注册 --Android开发
  19. [python] 私有变量和私有方法
  20. linux设置开机同步时间

热门文章

  1. Wcf资料收集
  2. CentOS 5.5 Samba服务器安装总结
  3. 在birt中解决引用了不存在的绑定出现的问题
  4. ORA-19502: write error on file "/u01/app/oracle/oradata/standby/system01.dbf", blockno 40321 (blocksize=8192)【error收集】
  5. PHP Sessions
  6. nat123 与微信公众号开发者测试账号配合调试
  7. explicit 关键字
  8. sqoop 1.4.4-cdh5.1.2快速入门
  9. DropdownList控件绑定数据源显示system.data.datarowview的问题
  10. HTML5+Css3-webkit-filter