Пример #1
0
 private void OnControlRemoved()
 {
     if (ControlRemoved != null)
     {
         ControlRemoved.Invoke(this, EventArgs.Empty);
     }
 }
Пример #2
0
    /// <summary>
    /// Removes control from list view
    /// </summary>
    /// <param name="destroyGameObject">If true game object of list view control will be destroyed</param>
    public void RemoveControl(GameObject control, bool destroyGameObject = true)
    {
        if (true == destroyGameObject)
        {
            GameObject.Destroy(control);
        }

        Controls.Remove(control);
        ControlRemoved?.Invoke(control);
    }
        public void RemoveControl()
        {
            string controlName = dataStack.Pop();

            if (Controls.ContainsKey(controlName))
            {
                ControlRemoved?.Invoke(this, Controls[controlName]);
                Controls.Remove(controlName);
            }
        }
            private void onListChanged(object sender, ListChangedEventArgs args)
            {
                switch (args.Type)
                {
                case ListChangedEventType.ItemsInserted: {
                    for (int i = 0; i < args.Count; i++)
                    {
                        var control = (Control)list[args.Index + i];
                        parent.InsertChildAt(args.Index + i, control);
                        if (ControlAdded != null)
                        {
                            ControlAdded.Invoke(control);
                        }
                    }
                    break;
                }

                case ListChangedEventType.ItemsRemoved:
                    for (int i = 0; i < args.Count; i++)
                    {
                        Control control = parent.Children[args.Index];
                        parent.RemoveChild(control);
                        if (ControlRemoved != null)
                        {
                            ControlRemoved.Invoke(control);
                        }
                    }
                    break;

                case ListChangedEventType.ItemReplaced: {
                    var removedControl = parent.Children[args.Index];
                    parent.RemoveChild(removedControl);
                    if (ControlRemoved != null)
                    {
                        ControlRemoved.Invoke(removedControl);
                    }

                    var addedControl = (Control)list[args.Index];
                    parent.InsertChildAt(args.Index, addedControl);
                    if (ControlAdded != null)
                    {
                        ControlAdded.Invoke(addedControl);
                    }
                    break;
                }
                }
            }
Пример #5
0
 /// <summary>
 /// Raises the ControlRemoved event.
 /// </summary>
 /// <param name="e">An ControlEventArgs containing the event data.</param>
 protected override void OnControlRemoved(ControlEventArgs e)
 {
     ControlRemoved?.Invoke(this, e);
 }
Пример #6
0
 private void _control_ControlRemoved(object sender, ControlEventArgs e)
 {
     ControlRemoved?.Invoke(_control, e);
     UnhookControlEvents(e.Control);
 }
Пример #7
0
 protected virtual void OnControlRemoved(object sender, EventArgs e)
 {
     ControlRemoved?.Invoke(sender, e);
 }