private void AddPlane_Click(object sender, EventArgs e) { this.Enabled = false; var addPlaneForm = new AddEditPlaneForm(); addPlaneForm.FormClosed += (a, b) => { PlaneForm_Load(a, b); this.Enabled = true; }; addPlaneForm.Show(); }
private void EditPlane(int rowIndex) { Plane plane; var d = (DataRowView)PlaneDataGrid.Rows[rowIndex].DataBoundItem; using (var db = new AirlinesContext()) { plane = db.Planes.Find(d.Row[0]); } var editPlaneForm = new AddEditPlaneForm(plane); this.Enabled = false; editPlaneForm.FormClosed += (a, b) => { PlaneForm_Load(a, b); this.Enabled = true; }; editPlaneForm.Show(); }