/// <summary> /// 获取数据列表 /// </summary> private void InitialDataGridView() { if (LoginCookie == null) { MessageBox.Show("请先登录!", "提示", MessageBoxButtons.OK, MessageBoxIcon.Error); } else { int totalSize = 22603; int TotalPage = 377; int pageSize = 60; int offset = 0; while (offset < totalSize) { string getParam = string.Format("tableInfo=%7B%22offset%22%3A{0}%2C%22pageSize%22%3A{1}%2C%22totalPage%22%3A{2}%2C%22totalSize%22%3A{3}%2C%22sortSet%22%3A%5B%7B%22id%22%3A%22dataid%22%2C%22sort%22%3A%22asc%22%7D%5D%2C%22filterSet%22%3A%5B%5D%7D&data=%7B%22datatype%22%3A%22gdem_utm2%22%7D&datatype=gdem_utm2" , offset, pageSize, TotalPage, totalSize); string result = m_mainWeb.HttpGet("http://www.gscloud.cn/sources/query_dataset/421", getParam); if (string.IsNullOrEmpty(result)) { MessageBox.Show("获取列表出错!", "提示", MessageBoxButtons.OK, MessageBoxIcon.Error); break; } else { object t = JsonConvert.DeserializeObject(result); JObject jsonobject = JObject.FromObject(t); JToken jsonToken = jsonobject.GetValue("data"); List <JToken> listObject = jsonToken.ToList(); for (int i = 0; i < listObject.Count; i++) { JToken jData = listObject[i]; JEnumerable <JToken> jChildren = jData.Children(); List <JToken> listChildren = jChildren.ToList <JToken>(); //初始化列 if (dgvAllData.Columns.Count == 0) { InitalDataGridColumn(listChildren); } Dictionary <string, string> tempList = new Dictionary <string, string>(); for (int j = 0; j < listChildren.Count(); j++) { JToken tempToken = listChildren[j]; JProperty tempObject = (JProperty)tempToken; tempList.Add(tempObject.Name, tempObject.Value.ToString()); } dgvAllData.Rows.Add(tempList.Values.ToArray()); m_mainWeb.m_DownLoadList.Add(tempList["dataid"].ToString()); } } offset += 60; } dgvAllData.Refresh(); } }