private void btAdd_Click(object sender, EventArgs e) { DevicePara form = new DevicePara(); if (form.ShowDialog(this) == DialogResult.OK) { if (Device == null) { Device = new CommonMqttJsonObject(); } Device.paras.Add(form.Pata); this.dataGridViewPara.DataSource = null; this.dataGridViewPara.DataSource = Device.paras; } }
private void btEdit_Click(object sender, EventArgs e) { if (this.dataGridViewPara.SelectedRows.Count <= 0) { return; } DevicePara form = new DevicePara(); form.Pata = (CommonMqttJsonPara)this.dataGridViewPara.SelectedRows[0].DataBoundItem; if (form.ShowDialog(this) == DialogResult.OK) { if (Device == null) { Device = new CommonMqttJsonObject(); } } }