private void AddItems(List <ToDoItemModel> items) { var minDate = DateTime.MinValue.AddYears(DateTime.Now.Year); foreach (var i in items) { var itemView = new ToDoItemView { Id = i.Id, Header = i.Header, Notes = i.Notes, Date = i.Date, Deadline = i.Deadline, CompleteDay = i.CompleteDay, ProjectId = i.ProjectId, ProjectName = i.ProjectName, Timer = i.Timer }; if (i.Deadline == minDate) { ToDoItems.Add(itemView); continue; } if (i.Deadline <= DateTime.Today) { itemView.DeadlineColor = "Red"; itemView.DeadlineShort = "today"; } else { var remainingDays = (i.Deadline - DateTime.Today).TotalDays; itemView.DeadlineColor = "Gray"; itemView.DeadlineShort = $"{remainingDays}d left"; } ToDoItems.Add(itemView); } }
protected override bool IsCorrect(ToDoItemView item) { return(true); }
protected override bool IsCorrect(ToDoItemView item) { // User didn't choose a date for task. return(item.Date == MinDate); }
protected override bool IsCorrect(ToDoItemView item) { // User chose today's date for task. return(item.Date <= DateTime.Today && item.Date != MinDate || item.Deadline <= DateTime.Today && item.Deadline != MinDate); }
protected abstract bool IsCorrect(ToDoItemView item);