private void toolStripButton编辑_Click(object sender, EventArgs e) { var current = this.bindingSource1.Current as StationInfo; if (current == null) { return; } var form = new ObjectEditForm <StationInfo>(); form.ObjToUi(current); if (form.ShowDialog() == System.Windows.Forms.DialogResult.OK) { form.UiToObj(current); this.dataGridView1.Refresh(); } }
private void 新建NToolStripButton_Click(object sender, EventArgs e) { var form = new ObjectEditForm <StationInfo>(); if (form.ShowDialog() == System.Windows.Forms.DialogResult.OK) { var o = form.UiToObj(); var all = bindingSource1.DataSource as List <StationInfo>; if (all == null) { return; } all.Add(o); DataBind(all); } }