InvokeRemoved() private method

private InvokeRemoved ( ) : void
return void
Example #1
0
        /// <summary>
        /// Removes a child at a certain index. Children above the child will move down.
        /// </summary>
        public DisplayObject RemoveChildAt(int index, bool dispose = false)
        {
            if (index >= 0 && index < _children.Count)
            {
                SetRequiresRedraw();

                DisplayObject child = _children[index];
                child.InvokeRemoved();

                if (Stage != null)
                {
                    child.BroadcastRemovedFromStageEvent(this);
                }

                child.Parent = null;
                int newIndex = _children.IndexOf(child); // index might have changed in event handler
                if (newIndex != -1)
                {
                    _children.RemoveAt(newIndex);
                }
                if (dispose)
                {
                    child.Dispose();
                }

                return(child);
            }
            throw new IndexOutOfRangeException("Invalid child index");
        }
 /// <summary>
 /// Removes a child at a certain index. Children above the child will move down.
 /// </summary>
 public void RemoveChildAt(int index)
 {
     if (index >= 0 && index < _children.Count)
     {
         DisplayObject child = _children[index];
         child.InvokeRemoved();
         if (Stage != null)
         {
             BroadcastRemovedFromStageEvent(this);
         }
         child.Parent = null;
         int newIndex = _children.IndexOf(child); // index might have changed in event handler
         if (newIndex != -1)
         {
             _children.RemoveAt(newIndex);
         }
     }
     else
     {
         throw new IndexOutOfRangeException("Invalid child index");
     }
 }