Exemple #1
0
        /// <summary>
        /// Decides whether the element that is represented by the proto element can be pasted or not.
        /// </summary>
        /// <param name="protoElement">Proto element representation of the element.</param>
        /// <param name="protoGroup">Proto group the proto element belongs to.</param>
        /// <returns>True if the element can be pasted. False otherwise.</returns>
        public virtual bool ModelCanMerge(ModelProtoElement protoElement, ModelProtoGroup protoGroup)
        {
            if (protoGroup.Operation == ModelProtoGroupOperation.Move)
            {
                return(false);
            }

            if (protoElement.CustomArguments is DiagramModelMergeOptions)
            {
                DiagramModelMergeOptions options = protoElement.CustomArguments as DiagramModelMergeOptions;

                Guid elementID             = options.ElementId;
                ModelProtoElement elementP = protoGroup.GetProtoElementFor(elementID, this.Partition);
                if (elementP != null)
                {
                    return((this.Element as IModelMergeElements).ModelCanMerge(elementP, protoGroup));
                }
            }

            return(false);
        }
        /// <summary>
        /// Decides whether the element that is represented by the proto element can be pasted or not.
        /// </summary>
        /// <param name="protoElement">Proto element representation of the element.</param>
        /// <param name="protoGroup">Proto group the proto element belongs to.</param>
        /// <returns>True if the element can be pasted. False otherwise.</returns>
        public virtual bool ModelCanMerge(ModelProtoElement protoElement, ModelProtoGroup protoGroup)
        {
            if (protoGroup.Operation == ModelProtoGroupOperation.Move)
                return false;

            if (protoElement.CustomArguments is DiagramModelMergeOptions)
            {
                DiagramModelMergeOptions options = protoElement.CustomArguments as DiagramModelMergeOptions;

                Guid elementID = options.ElementId;
                ModelProtoElement elementP = protoGroup.GetProtoElementFor(elementID, this.Partition);
                if (elementP != null)
                {
                    return (this.Element as IModelMergeElements).ModelCanMerge(elementP, protoGroup);
                }
            }

            return false;
        }