protected override void RemoveItem(int index) { SopInstanceNode node = base[index].Node; _map[node].PropertyChanged -= Item_PropertyChanged; _map.Remove(node); _list.Remove(node); base.RemoveItem(index); }
internal ImageItem GetByUid(DicomFile dicomFile, IPresentationImage image) { SopInstanceNode node = _list.GetImageByUid(dicomFile); if (!_map.ContainsKey(node)) { base.Insert(_list.IndexOf(node), new ImageItem(node, image)); } return(_map[node]); }
protected override void InsertItem(int index, ImageItem item) { SopInstanceNode node = item.Node; _map.Add(node, item); if (!_list.Contains(node)) // this method is also called when initializing the list from the list, so we need to check this to avoid re-adding { _list.Insert(index, node); } base.InsertItem(index, item); item.PropertyChanged += Item_PropertyChanged; }
protected override void SetItem(int index, ImageItem item) { SopInstanceNode oldNode = base[index].Node; SopInstanceNode newNode = item.Node; _map.Add(newNode, item); _map[oldNode].PropertyChanged -= Item_PropertyChanged; _map.Remove(oldNode); _list.Remove(oldNode); _list.Insert(index, newNode); item.PropertyChanged += Item_PropertyChanged; base.SetItem(index, item); }