コード例 #1
0
        /// <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);
            }
        }
コード例 #2
0
        /// <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));
            }
        }