Beispiel #1
0
        //Mark a completed item as not finished
        public void MarkAsInComplete(ToDoListItem toDoListItem)
        {
            if (toDoListItem is null)
            {
                throw new ArgumentNullException(nameof(toDoListItem));
            }

            if (toDoListItem.IsCompleted == false)
            {
                tasks.Remove(toDoListItem);     //remove item from completed list -if it is unfinish
                ToDoList toDoList = new ToDoList();
                toDoList.AddItem(toDoListItem); //add that item to todo list again as unfinish task-if a task marked as completed and possible mark as incompleted
            }
        }
Beispiel #2
0
        //add an repeating task as completed
        public void RepeatCompleted(ToDoListItem toDoListItem, RepeatingTask repeatingTask)
        {
            if (toDoListItem is null)
            {
                throw new ArgumentNullException(nameof(toDoListItem));
            }

            if (toDoListItem.IsCompleted == true)
            {
                tasks.Add(toDoListItem);
            }


            if (repeatingTask.EndTime <= DateTime.Now)
            {
                tasks.Remove(toDoListItem);     //task remove from completed
                ToDoList toDoList = new ToDoList();
                toDoList.AddItem(toDoListItem); //added to todo list again for next routine
            }
        }