예제 #1
0
        private void InitControls()
        {
            this.kryptonDataGridView1.Rows.Clear();
            var response = WebRequestUtil.GetAdvList();

            if (response != null)
            {
                var res = JsonUtil.Deserialize <QSWResponse <List <AdvModel> > >(response.Content);
                foreach (var adv in res.Data)
                {
                    int index = this.kryptonDataGridView1.Rows.Add();
                    this.kryptonDataGridView1.Rows[index].Cells[0].Value = this.GetAdvTypeStr(adv.AdvTypeId);
                    this.kryptonDataGridView1.Rows[index].Cells[1].Value = this.GetAdvContentStr(adv.AdvTypeId, adv.AdvInnerId);
                    this.kryptonDataGridView1.Rows[index].Cells[2].Value = adv.AdvSart;
                    this.kryptonDataGridView1.Rows[index].Cells[3].Value = adv.AdvImage;
                    this.kryptonDataGridView1.Rows[index].Tag            = adv;
                }

                if (res.Data.Count > 0)
                {
                    this.kryptonDataGridView1.Rows[0].Selected = false;
                    this.kryptonDataGridView1.Rows[0].Selected = true;
                }
            }
        }