コード例 #1
0
        private bool VerifyRemoveChild(Node node)
        {
            ModifyChildrenResult result = this.owner.CanRemoveChild(node);

            if (result == ModifyChildrenResult.Cancel)
            {
                return(false);
            }

            if (result == ModifyChildrenResult.Refuse)
            {
                throw new ArgumentException("Specified node may not be removed from the element");
            }

            return(true);
        }
コード例 #2
0
        private bool VerifyAddChild(Node node)
        {
            ModifyChildrenResult result = this.owner.CanAddChild(node);

            if (result == ModifyChildrenResult.Cancel)
            {
                return(false);
            }

            if (result == ModifyChildrenResult.Refuse)
            {
                throw new ArgumentException("Specified node is not accepted by the element");
            }

            if (node.parent != null)
            {
                throw new InvalidOperationException("ChildNode is already parented by a ChartElement instance.");
            }

            return(true);
        }