protected void NewTrain(GridView view, TrainDirection direction) { using (var tef = new TrainEditForm(tt, direction)) { if (tef.ShowModal(this) == DialogResult.Ok) { tt.AddTrain(tef.Train, true); UpdateListView(view, direction); } } }
protected void EditTrain(GridView view, TrainDirection dir, bool message = true) { if (view.SelectedItem != null) { Train train = (Train)view.SelectedItem; using (var tef = new TrainEditForm(train)) if (tef.ShowModal(this) == DialogResult.Ok) { UpdateListView(view, dir); } } else if (message) { MessageBox.Show("Zuerst muss ein Zug ausgewählt werden!", "Zug bearbeiten"); } }