private void btnAdd_Click(object sender, EventArgs e) { MatchItem matchNew = new MatchItem( txtTeam1.Text, txtTeam2.Text, MatchHelper.MergeDate(dtpDateBegin.Value, dtpTimeBegin.Value), (int)nudDuration.Value); if (matchNew.DateBegin < DateTime.Now) { MessageBox.Show(Strings.NotAdd, Application.ProductName, MessageBoxButtons.OK, MessageBoxIcon.Warning); return; } string matchIntersects = MatchHelper.ToIntersectsString(matchProvider, matchNew); if (matchIntersects == string.Empty || MessageBox.Show(Strings.IntersectAdd + matchIntersects, Application.ProductName, MessageBoxButtons.YesNo, MessageBoxIcon.Question) == DialogResult.Yes) { matchProvider.Add(matchNew); matchProvider.Save(); lstMatches.Items.Clear(); matchProvider.Load(); lstMatches.SetSelected(matchProvider.Count - 1, true); } }