protected List<Period> Split(DateTime offsetDate) { var firstPeriod = new Period() { Start = min, End = Increase(offsetDate, 1) }; result.Add(firstPeriod); if (firstPeriod.End >= max) { firstPeriod.End = max; return result; } int i = 1; while (Increase(offsetDate, i) < max) { var period = new Period() { Start = Increase(offsetDate, i), End = Increase(offsetDate, i + 1) }; if (period.End >= max) period.End = max; result.Add(period); i++; } return result; }
public GanttControl() { InitializeComponent(); DataContext = this; SelectionPeriod = new Period(); }
private void NewClicked(Period selectionPeriod) { MessageBox.Show("New clicked for task " + selectionPeriod.Start.ToString() + " -> " + selectionPeriod.End.ToString()); }
private string FormatYear(Period period) { return period.Start.Year.ToString(); }
private string FormatMonth(Period period) { return period.Start.Month.ToString(); }
private string FormatDayName(Period period) { return period.Start.DayOfWeek.ToString(); }
private string FormatDay(Period period) { return period.Start.Day.ToString(); }