예제 #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
 /// <summary>
 /// This method undos the operation
 /// </summary>
 public void Undo()
 {
     //se eliminan los GraphElements de la capa de diagrama y del Logical diagram
     GraphDiagram.DeleteElements(this.diagramLayer, this.diagram, this.graphElements);
     //The diagram layer is updated
     this.diagramLayer.UpdateSurface();
     //It is indicated that the diagram has changed
     if (this.DiagramChanged != null)
     {
         this.DiagramChanged(this, new EventArgs());
     }
 }
예제 #3
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));
            }
        }