示例#1
0
        private void LoadGasStoreList()
        {
            cboGasStore.Items.Clear();
            Task <String> task = SGM_WaitingIdicator.WaitingForm.waitingFrm.progressReporter.RegisterTask(
                () =>
            {
                return(m_service.SGMManager_GetGasStoreList());
            });

            SGM_WaitingIdicator.WaitingForm.waitingFrm.progressReporter.RegisterContinuation(task, () =>
            {
                String stResponse         = task.Result as String;
                DataTransfer dataResponse = JSonHelper.ConvertJSonToObject(stResponse);
                if (dataResponse.ResponseCode == DataTransfer.RESPONSE_CODE_SUCCESS)
                {
                    DataSet ds          = dataResponse.ResponseDataSet;
                    DataTable tblResult = ds.Tables[0];
                    if (tblResult.Rows.Count > 0)
                    {
                        //ComboboxItem itemAll = new ComboboxItem();
                        //itemAll.Text = SGMText.SGM_ALL;
                        //itemAll.Value = "";
                        //cboGasStore.Items.Add(itemAll);
                        foreach (DataRow dr in tblResult.Rows)
                        {
                            ComboboxItem item = new ComboboxItem();
                            item.Text         = dr["GASSTORE_NAME"].ToString();
                            item.Value        = dr["GASSTORE_ID"].ToString();
                            cboGasStore.Items.Add(item);
                        }
                        if (cboGasStore.Items.Count > 0)
                        {
                            cboGasStore.SelectedIndex = 0;
                        }
                    }
                }
                else
                {
                    frmMsg.ShowMsg(SGMText.SGM_ERROR, dataResponse.ResponseErrorMsgDetail, SGMMessageType.SGM_MESSAGE_TYPE_ERROR);
                }
            }, SynchronizationContext.Current);
        }