コード例 #1
0
 private void OnControlRemoved()
 {
     Redraw();
     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);
    }
コード例 #3
0
        public void RemoveControl()
        {
            string controlName = dataStack.Pop();

            if (Controls.ContainsKey(controlName))
            {
                ControlRemoved?.Invoke(this, Controls[controlName]);
                Controls.Remove(controlName);
            }
        }
コード例 #4
0
            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
ファイル: Control.cs プロジェクト: polytronicgr/Axiverse
 protected virtual void OnControlRemoved(object sender, EventArgs e)
 {
     ControlRemoved?.Invoke(sender, e);
 }