/// <summary> /// Usuwa pojedynczy WorkItem z Kolekcji, jeżeli istnieje. /// </summary> /// <param name="workItem"></param> public void DeleteWorkItem(WorkItemPublic workItem) { Ensure.ParamNotNull(workItem, nameof(workItem)); CtrlWorkItemDisplay toRemove = TaskBoard.FirstOrDefault(tb => ((WorkItemDisplayViewModel)tb.DataContext).WorkItem.ID == workItem.ID); if (toRemove != null) { TaskBoard.Remove(toRemove); } }
/// <summary> /// Dodaje pojedynczy WorkItem do Kolekcji, lub aktualizuje jego parametry, jeżeli już istnieje. /// </summary> /// <param name="workItem"></param> public void LoadOrUpdateWorkItem(WorkItemPublic workItem) { Ensure.ParamNotNull(workItem, nameof(workItem)); CtrlWorkItemDisplay toUpdate = TaskBoard.FirstOrDefault(tb => ((WorkItemDisplayViewModel)tb.DataContext).WorkItem.ID == workItem.ID); if (toUpdate != null) { WorkItemPublic workItemPublic = ((WorkItemDisplayViewModel)toUpdate.DataContext).WorkItem = workItem; ((WorkItemDisplayViewModel)toUpdate.DataContext).UpdateDisplayProperties(); } else { TaskBoard.Add(new CtrlWorkItemDisplay(workItem, DayOffset, mContext)); } }