示例#1
0
        /// <summary>
        /// This method executes the insert operation after the insertion position has been set
        /// </summary>
        public void Do()
        {
            if (!GraphDiagram.ValidateCopy(this.selectLayer.Elements))
            {
                MowayMessageBox.Show(CutMessages.CUT_START, CutMessages.CUT, MessageBoxButtons.OK, MessageBoxIcon.Error);
                this.Cancel();
                return;
            }
            //The items to be copied are loaded
            List <GraphElement> elementsToCut = GraphDiagram.GetElementsToCopy(this.selectLayer);
            List <GraphElement> cloneElements = GraphDiagram.CloneElements(elementsToCut);

            GraphManager.Clipboard.SetElements(cloneElements);

            this.elementsToDelete = GraphDiagram.GetElementsToDelete(this.selectLayer);
            GraphDiagram.DeleteElements(this.diagramLayer, this.diagram, this.elementsToDelete);
            //Cleans and hides the selection layer
            this.selectLayer.ClearAndHide();
            //Updates the diagram layer
            this.diagramLayer.UpdateSurface();
            if (this.DiagramChanged != null)
            {
                this.DiagramChanged(this, new EventArgs());
            }
            if (this.ElementSelectedChanged != null)
            {
                this.ElementSelectedChanged(this, new EventArgs());
            }
            //Launch Event of operation completed
            if (this.OperationFinished != null)
            {
                this.OperationFinished(this, new OperationEventArgs(Operation.Cut));
            }
        }
示例#2
0
        public void Do()
        {
            if (!this.ValidateDelete())
            {
                MowayMessageBox.Show(DeleteMessages.DELETE_START, DeleteMessages.DELETE_OBJECT, MessageBoxButtons.OK, MessageBoxIcon.Error);
                this.Cancel();
                return;
            }

            if (GraphSettings.Default.DeleteWarning == true)
            {
                bool showAgain = true;
                if (DialogResult.No == MowayMessageBox.Show(DeleteMessages.WARNING_DELETE + "\r\n" + DeleteMessages.CONTINUE, DeleteMessages.DELETE_OBJECT, MessageBoxButtons.YesNo, MessageBoxIcon.Warning, ref showAgain))
                {
                    this.Cancel();
                    GraphSettings.Default.DeleteWarning = showAgain;
                    GraphSettings.Default.Save();
                    return;
                }
                GraphSettings.Default.DeleteWarning = showAgain;
                GraphSettings.Default.Save();
            }
            this.elementsToDelete = GraphDiagram.GetElementsToDelete(this.selectLayer);
            GraphDiagram.DeleteElements(this.diagramLayer, this.diagram, this.elementsToDelete);
            //Cleans and hides the selection layer
            this.selectLayer.ClearAndHide();
            //Updates the diagram layer
            this.diagramLayer.UpdateSurface();
            if (this.DiagramChanged != null)
            {
                this.DiagramChanged(this, new EventArgs());
            }
            if (this.ElementSelectedChanged != null)
            {
                this.ElementSelectedChanged(this, new EventArgs());
            }
            //Launch Event of operation completed
            if (this.OperationFinished != null)
            {
                this.OperationFinished(this, new OperationEventArgs(Operation.Delete));
            }
        }