예제 #1
0
        public virtual void OnObjectLeft(object localizable)
        {
            if (!subItems.Contains(localizable))
            {
                throw new InvalidOperationException("item is not in collection");
            }

            subItems.Remove(localizable);

            var grabable = localizable as IGrabableItem;

            if (grabable != null)
            {
                foreach (var storage in Spaces)
                {
                    storage.RemoveItem(grabable, false);
                }
            }
            SubItemsChanged?.Invoke(this, new EventArgs());
        }
예제 #2
0
        public virtual void OnObjectEntered(object localizable, bool addToSpacd = true)
        {
            if (subItems.Contains(localizable))
            {
                throw new InvalidOperationException("item already in collection");
            }

            subItems.Add(localizable);

            if (addToSpacd)
            {
                var grabable = localizable as IGrabableItem;
                if (grabable != null)
                {
                    var space = SpaceManager.GetSpace(grabable);
                    space.AddItem(grabable, false);
                }
            }

            SubItemsChanged?.Invoke(this, new EventArgs());
        }