以文本方式查看主题 - Foxtable(狐表) (http://foxtable.net/bbs/index.asp) -- 专家坐堂 (http://foxtable.net/bbs/list.asp?boardid=2) ---- 移动开发 进度条 (http://foxtable.net/bbs/dispbbs.asp?boardid=2&id=124118) |
-- 作者:133198609 -- 发布时间:2018/8/31 0:15:00 -- 移动开发 进度条 移动开发过程中,获取企业微信全部用户信息,耗时较大,这个进度条的最大值和当前值取哪个? Dim ur As String = "https://qyapi.weixin.qq.com/cgi-bin/user/list?access_token={0}&department_id=1&fetch_child=1&status=0" Dim hc As New HttpClient(CExp(ur,Functions.Execute("GetQYAccessToken"))) Dim jo As JObject = JObject.Parse(hc.GetData()) If jo("errcode") = "0" Then DataTables("Users").DataRows.Clear Dim nms() As String = {"userid","name","position","mobile","gender","email","weixinid","avatar","status"} \'"" For Each jt As JToken In jo("userlist") Dim dr As DataRow = DataTables("Users").AddNew() For Each nm As String In nms dr(nm) = jt(nm) Next If dr("department") IsNot Nothing dr("department") = CompressJson(jt("department")).Trim("[","]") End If If jt("extattr") IsNot Nothing Then dr("extattr") = ComPressJson(jt("extattr")("attrs")).Trim("[","]") End If Next DataTables("Users").Save() Else MessageBox.Show(jo.ToString) End If |
-- 作者:有点甜 -- 发布时间:2018/8/31 9:31:00 -- 1、可以用异步函数取获取处理,这样不用卡死
http://www.foxtable.com/mobilehelp/scr/3269.htm
2、你要整体获取完毕,你才能知道返回多少数据的,也就是下面代码要执行完才能得到数据
Dim jo As JObject = JObject.Parse(hc.GetData()) |
-- 作者:133198609 -- 发布时间:2018/8/31 23:41:00 -- 这个异步函数,太牛了,之前很多加载了什么的,都卡死,这一下就解决了 |