protected override void UpdateUserInterface() { CmdDelete.Enabled = DaysExcluded.SelectedIndex > -1; CmdAdd.Enabled = !mExcludedDates.Contains(ExcludeDay.Value.Date); foreach (var excDate in mCalendar.ExcludedDates) { mCalendar.RemoveExcludedDate(excDate); } foreach (var excDate in mExcludedDates) { mCalendar.AddExcludedDate(excDate); } mCalendar.Description = string.Format("Excluding {0} dates: ", mCalendar.ExcludedDates.Count); foreach (var excDate in mCalendar.ExcludedDates) { mCalendar.Description += excDate.Date.ToString(CultureInfo.CurrentCulture.DateTimeFormat.ShortDatePattern) + ", "; } mCalendar.Description = mCalendar.Description.TrimEnd(new[] { ',', ' ' }); }
public void TestAddAndRemoveExclusion() { cal.AddExcludedDate(new DateTime(2007, 10, 20, 12, 40, 22)); cal.RemoveExcludedDate(new DateTime(2007, 10, 20, 2, 0, 0)); Assert.IsTrue(cal.ExcludedDates.Count == 0); }