Example #1
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);
        }