/// <summary> /// Adds an item to the system using the ItemCollector /// Fires a <see cref="ListUpdatedEvent"/> after completion /// </summary> /// <param name="toAdd">Item to add</param> public async void AddItem(Item toAdd) { if (string.IsNullOrEmpty(toAdd.Name)) { Log.File.Warning("Attempted to add an empty ingredient to list."); return; } toAdd.Name = toAdd.Name.Trim(); await _itemCollector.Add(toAdd, _loginModel.ShoppinglistId); ShoppingList.Add(toAdd); UpdateShoppingList(); ListUpdatedEvent?.Invoke(this, new EventArgs()); }
remove => RemoveHandler(ListUpdatedEvent, value);
add => AddHandler(ListUpdatedEvent, value);