Ejemplo n.º 1
0
        /// <summary>
        /// Method creates a new ToDo item, assignes it to the Assignee if any.
        /// The new ToDo item is then inserted into the items list and finally returned.
        /// </summary>
        /// <param name="assignee"></param>
        /// <param name="description"></param>
        /// <returns>Returns the object of the created ToDo item</returns>
        public ToDo AddToDoItem(Person assignee = null, string description = "Nothing")
        {
            int nextItemId = ToDoSequencer.NextId();

            ToDo newTodo = new ToDo(nextItemId, description);

            newTodo.Assignee = assignee;

            //extend array by one.
            int arrayLength = this.Size();

            Array.Resize(ref myItems, arrayLength + 1);
            myItems[arrayLength] = newTodo;

            return(newTodo);
        }
Ejemplo n.º 2
0
 /// <summary>
 /// The method creates a new empty list of ToDo items and
 /// discards the old Array. Reset is also done on the sequenser.
 /// </summary>
 public void Clear()
 {
     myItems = new ToDo[0];
     ToDoSequencer.Reset();
 }