private void LoadGasStoreList() { Task <String> task = SGM_WaitingIdicator.WaitingForm.waitingFrm.progressReporter.RegisterTask( () => { return(m_service.SGMManager_GetGasStore(null)); }); SGM_WaitingIdicator.WaitingForm.waitingFrm.progressReporter.RegisterContinuation(task, () => { String stResponse = task.Result as String; DataTransfer response = JSonHelper.ConvertJSonToObject(stResponse); dgvGSList.Rows.Clear(); m_dsGasStore = response.ResponseDataSet; int iOldSelected = m_iCurrentGSIndex; if (m_dsGasStore != null && dgvGSList.ColumnCount > 0) { for (int i = 0; i < m_dsGasStore.Tables[0].Rows.Count; i++) { dgvGSList.Rows.Add(); dgvGSList.Rows[i].Cells[0].Value = (i + 1); dgvGSList.Rows[i].Cells[1].Value = m_dsGasStore.Tables[0].Rows[i]["GASSTORE_ID"]; dgvGSList.Rows[i].Cells[2].Value = m_dsGasStore.Tables[0].Rows[i]["GASSTORE_NAME"]; dgvGSList.Rows[i].Cells[3].Value = m_dsGasStore.Tables[0].Rows[i]["GASSTORE_GAS92_TOTAL"]; dgvGSList.Rows[i].Cells[4].Value = m_dsGasStore.Tables[0].Rows[i]["GASSTORE_GAS95_TOTAL"]; dgvGSList.Rows[i].Cells[5].Value = m_dsGasStore.Tables[0].Rows[i]["GASSTORE_GASDO_TOTAL"]; } if (iOldSelected >= 0) { m_iCurrentGSIndex = iOldSelected; } if (m_iCurrentGSIndex >= dgvGSList.Rows.Count) { m_iCurrentGSIndex = -1; } if (m_iCurrentGSIndex >= 0) { dgvGSList.Rows[m_iCurrentGSIndex].Selected = true; } } }, SynchronizationContext.Current); }