Beispiel #1
0
        /// <summary>
        /// Reverses a delete vertex command.
        /// </summary>
        /// <returns>true if successful, otherwise false</returns>
        /// <remarks>
        /// This method inserts the vertex back into the object.
        /// </remarks>
        public override bool Undo()
        {
            bool success = false;

            if (this.Node != null)
            {
                IPoints objPoints = this.Node as IPoints;
                if (objPoints != null)
                {
                    if (this.vertexIdx >= 0 && this.vertexIdx <= objPoints.PointCount)
                    {
                        objPoints.InsertPoint(this.vertexIdx, this.ptValue);
                        success = true;
                    }
                }
            }

            return(success);
        }
Beispiel #2
0
        /// <summary>
        /// Inserts the specified vertex into the node.
        /// </summary>
        /// <param name="cmdTarget">Unused</param>
        /// <returns>true if successful, otherwise false</returns>
        /// <remarks>
        /// <seealso cref="Syncfusion.Windows.Forms.Diagram.IPoints"/>
        /// </remarks>
        public override bool Do(object cmdTarget)
        {
            bool success = false;

            if (this.Node != null)
            {
                IPoints objPoints = this.Node as IPoints;
                if (objPoints != null)
                {
                    if (this.vertexIdx >= 0 && this.vertexIdx <= objPoints.PointCount)
                    {
                        try
                        {
                            objPoints.InsertPoint(this.vertexIdx, this.point);
                            success = true;
                        }
                        catch
                        {
                            success = false;
                        }
                    }
                    else if (this.vertexIdx == -1)
                    {
                        try
                        {
                            objPoints.AddPoint(this.point);
                            this.vertexIdx = objPoints.PointCount - 1;
                            success        = true;
                        }
                        catch
                        {
                            success = false;
                        }
                    }
                }
            }

            return(success);
        }