示例#1
0
        protected override void RemoveItem(int index)
        {
            SeriesNode node = base[index].Node;

            _map[node].PropertyChanged -= Item_PropertyChanged;
            _map.Remove(node);
            _list.Remove(node);

            base.RemoveItem(index);
        }
示例#2
0
        internal SeriesItem GetByUid(DicomAttributeCollection dataSet)
        {
            SeriesNode node = _list.GetSeriesByUid(dataSet);

            if (!_map.ContainsKey(node))
            {
                base.Insert(_list.IndexOf(node), new SeriesItem(node));
            }
            return(_map[node]);
        }
示例#3
0
            protected override DragDropOption PerformDropForeignItems(IList <IGalleryItem> droppingItems, IGalleryItem targetItem, DragDropOption actions, ModifierFlags modifiers)
            {
                StudyItem      study  = (StudyItem)targetItem;
                DragDropOption action = DragDropOption.None;

                foreach (IGalleryItem droppingItem in droppingItems)
                {
                    if (droppingItem is SeriesItem)
                    {
                        SeriesItem series = (SeriesItem)droppingItem;
                        if (modifiers == ModifierFlags.None)
                        {
                            if (!study.Series.Contains(series))
                            {
                                study.Series.Add(series.Copy());
                                action = DragDropOption.Move;
                            }
                        }
                        else if (modifiers == ModifierFlags.Shift)
                        {
                            study.Series.Add(series.Copy());
                            action = DragDropOption.Copy;
                        }
                    }
                    else if (droppingItem is ImageItem)
                    {
                        ImageItem image = (ImageItem)droppingItem;
                        if (modifiers == ModifierFlags.None)
                        {
                            SeriesNode seriesNode = (SeriesNode)GetNodeAncestor(image.Node, 1);
                            StudyNode  studyNode  = (StudyNode)GetNodeAncestor(seriesNode, 1);
                            if (study.Node != studyNode)
                            {
                                SeriesItem series = new SeriesItem(seriesNode.Copy(false));
                                series.Images.Add(image.Copy());
                                series.UpdateIcon();
                                study.Series.Add(series);
                                action = DragDropOption.Move;
                            }
                        }
                        else if (modifiers == ModifierFlags.Shift)
                        {
                            SeriesNode seriesNode = (SeriesNode)GetNodeAncestor(image.Node, 1);
                            SeriesItem series     = new SeriesItem(seriesNode.Copy(false));
                            series.Images.Add(image.Copy());
                            series.UpdateIcon();
                            study.Series.Add(series);
                            action = DragDropOption.Copy;
                        }
                    }
                }
                return(action);
            }
示例#4
0
        protected override void SetItem(int index, SeriesItem item)
        {
            SeriesNode oldNode = base[index].Node;
            SeriesNode 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);
        }
示例#5
0
        protected override void InsertItem(int index, SeriesItem item)
        {
            SeriesNode 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;
        }