Пример #1
0
        public virtual void RemoveItem(List <UndoRedoAction> undoPipe)
        {
            lock (Board.ParentControl)
            {
                List <BoardItem> items = boundItems.Keys.ToList();
                foreach (BoardItem item in items)
                {
                    item.RemoveItem(undoPipe);
                }

                if (undoPipe != null)
                {
                    undoPipe.Add(UndoRedoManager.ItemDeleted(this));
                }
                if (parent != null)
                {
                    if (!(parent is Mouse) && undoPipe != null)
                    {
                        undoPipe.Add(UndoRedoManager.ItemsUnlinked(parent, this, (Microsoft.Xna.Framework.Point)parent.boundItems[this]));
                    }
                    parent.ReleaseItem(this);
                }
                Selected = false;
                board.BoardItems.Remove(this);
            }
        }
Пример #2
0
        public virtual void RemoveItem(ref List <UndoRedoAction> undoPipe)
        {
            object[] keys = new object[boundItems.Keys.Count];
            boundItems.Keys.CopyTo(keys, 0);
            foreach (object key in keys)
            {
                ((BoardItem)key).RemoveItem(ref undoPipe);
            }

            undoPipe.Add(UndoRedoManager.ItemDeleted(this));
            if (parent != null)
            {
                if (!(parent is Mouse))
                {
                    undoPipe.Add(UndoRedoManager.ItemsUnlinked(parent, this, (Microsoft.Xna.Framework.Point)parent.boundItems[this]));
                }
                parent.ReleaseItem(this);
            }
            Selected = false;
            board.BoardItems.Remove(this);
        }