private void button3_Click(object sender, EventArgs e) { using (var m = new ModelCreator()) { var result = m.ShowDialog(); if (result == DialogResult.OK) { var model = m.Model; RegisterModel(model); } } }
private void modelsListBox_DoubleClick(object sender, EventArgs e) { if (modelsListBox.SelectedItem != null) { var model = (Model)modelsListBox.SelectedItem; using (var m = new ModelCreator()) { m.PopulateWithModel(model); var result = m.ShowDialog(); if (result == DialogResult.OK) { RegisterModel(m.Model); } } } }