private void BtnAddTiming_Click(object sender, EventArgs e)
        {
            using (TrainLocationTimeEditForm form = new TrainLocationTimeEditForm
            {
                Model = new TrainLocationTimeEditFormModel((_model != null && _model.ValidLocations != null) ? _model.ValidLocations : new LocationCollection(),
                                                           _model?.ValidTimingPointNotes != null ? _model.ValidTimingPointNotes : new List <Note>())
                {
                    Data = new TrainLocationTime {
                        FormattingStrings = _model.DocumentOptions.FormattingStrings
                    },
                    InputMode = _model.DocumentOptions.ClockType,
                }
            })
            {
                if (form.ShowDialog() != DialogResult.OK)
                {
                    return;
                }

                if (_model == null || _model.Data == null)
                {
                    return;
                }

                _model.Data.TrainTimes.Add(form.Model.Data);
            }
            _model.Data.TrainTimes.Sort(new TrainLocationArrivalTimeComparer());
            UpdateTimingsViewFromModel();
        }
 private void EditTimingRow(int rowIndex)
 {
     if (Model == null || Model.Data == null || Model.Data.TrainTimes == null || Model.Data.TrainTimes.Count <= rowIndex)
     {
         return;
     }
     using (TrainLocationTimeEditForm form = new TrainLocationTimeEditForm
     {
         Model = new TrainLocationTimeEditFormModel(Model.ValidLocations, Model.ValidTimingPointNotes ?? new List <Note>())
         {
             Data = Model.Data.TrainTimes[rowIndex].Copy(),
             InputMode = Model.DocumentOptions.ClockType,
         }
     })
     {
         if (form.ShowDialog() != DialogResult.OK || form.Model == null || form.Model.Data == null)
         {
             return;
         }
         Model.Data.TrainTimes[rowIndex] = form.Model.Data;
     }
     Model.Data.TrainTimes.Sort(new TrainLocationArrivalTimeComparer());
     UpdateTimingsViewFromModel();
 }