private void EditSignalboxHoursSet(SignalboxHoursSet selectedSignalboxHoursSet) { using (SignalboxHoursSetEditForm form = new SignalboxHoursSetEditForm { Model = new SignalboxHoursSetEditFormModel { Data = selectedSignalboxHoursSet.Copy(), InputMode = Model.Options.ClockType } }) { DialogResult result = form.ShowDialog(); Log.Trace("SignalboxHoursSetEditForm.ShowDialog() returned {0}", result); if (result != DialogResult.OK) { return; } form.Model.Data.CopyTo(selectedSignalboxHoursSet); } }
private void AddBoxHours() { SignalboxHoursSetEditFormModel model = new SignalboxHoursSetEditFormModel { InputMode = Model.Options.ClockType, Data = new SignalboxHoursSet() }; foreach (var box in Model.Signalboxes) { model.Data.Hours.Add(box.Id, new SignalboxHours { Signalbox = box }); } using (SignalboxHoursSetEditForm form = new SignalboxHoursSetEditForm { Model = model }) { DialogResult result = form.ShowDialog(); Log.Trace("SignalboxHoursSetEditForm.ShowDialog() returned {0}", result); if (result == DialogResult.OK) { Model.SignalboxHoursSets.Add(form.Model.Data); } } }