コード例 #1
0
ファイル: ChildrenList.cs プロジェクト: Ju2ender/csharp-e
        private void SubscribeBlock(Block block)
        {
            ContainerBlock oldParent = block.Parent;
            RootBlock oldRoot = block.Root;

            // set block's parent
            block.Parent = this.Parent;
            block.MyControl.Parent = Parent.MyControl as ContainerControl;

            // set block's root
            if (Parent.Root != null)
            {
                block.Root = Parent.Root;
                block.MyControl.Root = Parent.Root.MyRootControl;
            }

            block.NotifyParentChanged(oldParent);
            block.NotifyRootChanged(oldRoot);

            // subscribe to block's events
            block.KeyDown += RaiseKeyDown;
        }
コード例 #2
0
ファイル: ChildrenList.cs プロジェクト: Ju2ender/csharp-e
        /// <summary>
        /// Unsubscribe from blocks events
        /// </summary>
        private void UnsubscribeBlock(Block block)
        {
            ContainerBlock oldParent = block.Parent;

            block.KeyDown -= RaiseKeyDown;

            block.Prev = null;
            block.Next = null;

            block.Root = null;
            block.MyControl.Root = null;

            block.Parent = null;
            block.MyControl.Parent = null;

            block.NotifyParentChanged(oldParent);

            block.OnAfterDelete();
        }