// Merges single operation to items list // and adds operation to operations list. public static void Merge(this DataSet data, Operation operation) { switch (operation.Type) { case OperationType.Create: data.CreateItem(operation); break; case OperationType.Reorder: data.ReorderItem(operation); break; case OperationType.ChangeStatus: data.ChangeItemStatus(operation); break; } }
// Merges list of operations to ItemViewModel collection. public static void Merge(this ObservableCollection<ItemViewModel> items, List<Operation> operations, Action<Item> onStatusChanged) { foreach (var operation in operations) { switch (operation.Type) { case OperationType.Create: items.CreateItem(operation, onStatusChanged); break; case OperationType.Reorder: items.MoveItem(operation); break; case OperationType.ChangeStatus: items.ChangeItemStatus(operation); break; } } }
/// <summary> /// Creates the item. /// </summary> /// <param name="database"> /// The database. /// </param> /// <param name="itemID"> /// The item ID. /// </param> /// <param name="itemName"> /// Name of the item. /// </param> /// <param name="templateID"> /// The template ID. /// </param> /// <returns> /// The <see cref="Item"/>. /// </returns> public static Item CreateItem(this Database database, ID itemID, string itemName, ID templateID) { return database.CreateItem(itemID, itemName, templateID, IDs.ItemIDs.HomeID); }