public void AddItem(ToDoListItem item)
 {
     item.Id = counter;
     Items.Add(item);
     counter++;
     OnToDoListUpdated?.Invoke(this, new Events.EventArgs.ToDoListUpdatedArgs());
 }
 public void UpdateItem(ToDoListItem old, ToDoListItem newItem)
 {
     old.CreationTime = newItem.CreationTime;
     old.Description  = newItem.Description;
     old.DueDate      = newItem.DueDate;
     old.Name         = newItem.Name;
     old.Completed    = newItem.Completed;
     OnToDoListUpdated?.Invoke(this, new Events.EventArgs.ToDoListUpdatedArgs());
 }
        public void LoadItems(FileInfo file)
        {
            var objects     = File.ReadAllText(file.FullName);
            var listOfItems = JsonConvert.DeserializeObject <List <ToDoListItem> >(objects);

            ClearData();
            foreach (var i in listOfItems)
            {
                Items.Add(i);
            }
            OnToDoListUpdated?.Invoke(this, new Events.EventArgs.ToDoListUpdatedArgs());
        }
 public void DeleteItem(ToDoListItem item)
 {
     Items.Remove(item);
     OnToDoListUpdated?.Invoke(this, new Events.EventArgs.ToDoListUpdatedArgs());
 }