Esempio n. 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));
            }
        }
Esempio n. 2
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(CopyMessages.COPY_START, CopyMessages.COPY, MessageBoxButtons.OK, MessageBoxIcon.Error);
                this.Cancel();
                return;
            }
            //The items to be copied are loaded
            List <GraphElement> elementsToCopy = GraphDiagram.GetElementsToCopy(this.selectLayer);
            List <GraphElement> cloneElements  = GraphDiagram.CloneElements(elementsToCopy);

            GraphManager.Clipboard.SetElements(cloneElements);
            //Launch Event of operation completed
            if (this.OperationFinished != null)
            {
                this.OperationFinished(this, new OperationEventArgs(Operation.Copy));
            }
        }