Exemplo n.º 1
0
        /// <summary>
        /// Sets the owner of the object.
        /// </summary>
        public void SetOwner(DragHolder inOwner, bool inbForce = false)
        {
            // We don't need to do anything
            // if this is our owner already
            if (Owner == inOwner)
            {
                return;
            }

            DragHolder oldOwner = Owner;

            if (Owner != null)
            {
                Owner.RemoveObject(this, inbForce);
                Assert.True(Index == -1, "DragObject was able to be removed.");
            }

            Owner = inOwner;

            if (Owner != null)
            {
                Owner.AddObject(this, inbForce);
                Assert.True(Index >= 0, "DragObject was able to be added.");
            }

            if (OnOwnerChange != null)
            {
                OnOwnerChange(this, oldOwner);
            }
        }