Пример #1
0
        /// <summary>Changes the inner node.</summary>
        /// <param name="node">The new node.</param>
        public void ChangeInnerNode(ClassNode node)
        {
            Contract.Requires(node != null);

            if (InnerNode != node)
            {
                InnerNode = node;

                InnerNodeChanged?.Invoke(this);

                ParentNode?.ChildHasChanged(this);
            }
        }
Пример #2
0
        /// <summary>Changes the inner node.</summary>
        /// <param name="node">The new node.</param>
        public void ChangeInnerNode(BaseNode node)
        {
            if (!CanChangeInnerNodeTo(node))
            {
                throw new InvalidOperationException($"Can't change inner node to '{node?.GetType().ToString() ?? "null"}'");
            }

            if (InnerNode != node)
            {
                InnerNode = node;

                if (node != null)
                {
                    node.ParentNode = this;
                }

                InnerNodeChanged?.Invoke(this);

                GetParentContainer()?.ChildHasChanged(this);
            }
        }