private void RemoveWorkItem(WorkItemViewModel viewModel) { int index = WorkItems.FindIndex(w => w.Id == viewModel.Id); if (index > -1) { WorkItems.RemoveAt(index); OnPropertyChanged("WorkItems"); } }
public override bool Equals(object obj) { WorkItemViewModel o = (obj as WorkItemViewModel); if (o != null) { return(o.Id.Equals(Id)); } return(base.Equals(obj)); }
private void UpdateWorkItemCollection(WorkItemViewModel viewModel, bool updateObservables) { int index = WorkItems.FindIndex(w => w.Id == viewModel.Id); if (index > -1) { WorkItems[index] = viewModel.WorkItem; } else { WorkItems.Add(viewModel.WorkItem); } if (updateObservables) { SetObservableWorkItems(); } }
private void UpdateSelectedWorkItem(WorkItemViewModel workItem) { if (IsDirty && workItem.IsDirty) { foreach (var item in ObservableWorkItems.Where(w => w.IsDirty)) { int dirtyIdx = DirtyWorkItems.FindIndex(w => w.Id == item.Id); if (dirtyIdx > -1) { DirtyWorkItems[dirtyIdx] = item.WorkItem; } else { DirtyWorkItems.Add(item.WorkItem); } } UpdateWorkItemCollection(workItem, false); OnPropertyChanged("WorkItemSummaryHoursCompleted"); } }