예제 #1
0
 /// <summary>
 /// Undo the operation
 /// </summary>
 public void Undo()
 {
     //The entered arrow is removed
     GraphDiagram.DeleteElement(this.diagramLayer, this.diagram, this.graphArrow);
     //Resets the eliminated arrow in the case that there was
     if (this.graphArrowToDelete != null)
     {
         //Add the deleted arrow starting with the element next
         this.graphArrowToDelete.Next.AddPrevious(this.graphArrowToDelete.FinalConnector, this.graphArrowToDelete);
         foreach (GraphElement prevElement in this.graphArrowToDelete.Previous)
         {
             prevElement.AddNext(this.graphArrowToDelete.InitConnector, this.graphArrowToDelete);
         }
         //The arrow is added to the diagram layer, and to the logical diagram
         this.diagramLayer.AddElement(this.graphArrowToDelete);
         this.diagram.AddElement(this.graphArrowToDelete.Element);
     }
     //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());
     }
 }
예제 #2
0
 public void Undo()
 {
     //The entered arrow is removed
     GraphDiagram.DeleteElement(this.diagramLayer, this.diagram, this.graphArrow);
     //Add the deleted arrow starting with the next element
     this.graphArrowToDelete.Next.AddPrevious(this.graphArrowToDelete.FinalConnector, this.graphArrowToDelete);
     foreach (GraphElement prevElement in this.graphArrowToDelete.Previous)
     {
         if (prevElement is GraphConditional)
         {
             ((GraphConditional)prevElement).AddNext(this.graphArrowToDelete.InitConnector, this.graphArrowToDelete, this.conditionalOut);
         }
         else
         {
             prevElement.AddNext(this.graphArrowToDelete.InitConnector, this.graphArrowToDelete);
         }
     }
     //The arrow is added to the diagram layer, and to the logical diagram
     this.diagramLayer.AddElement(this.graphArrowToDelete);
     this.diagram.AddElement(this.graphArrowToDelete.Element);
     //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 you are modifying the next of an item...
     if (this.nextEnable)
     {
         if (this.presentConnector.Parent is GraphConditional)
         {
             this.conditionalOut = ((GraphConditional)this.presentConnector.Parent).GetPredefOut(this.presentConnector);
             if ((conditionalOut == ConditionalOut.True) && (((GraphConditional)this.presentConnector.Parent).NextTrue != null))
             {
                 if (DialogResult.Yes != MowayMessageBox.Show(InsertArrowMessages.REPLACE_TRUE + "\r\n" + InsertArrowMessages.CONTINUE, InsertArrowMessages.INSERT_ARROW, MessageBoxButtons.YesNo, MessageBoxIcon.Warning))
                 {
                     this.Cancel();
                     return;
                 }
                 else if ((conditionalOut == ConditionalOut.False) && (((GraphConditional)this.presentConnector.Parent).NextFalse != null))
                 {
                     if (DialogResult.Yes != MowayMessageBox.Show(InsertArrowMessages.REPLACE_FALSE + "\r\n" + InsertArrowMessages.CONTINUE, InsertArrowMessages.INSERT_ARROW, MessageBoxButtons.YesNo, MessageBoxIcon.Warning))
                     {
                         this.Cancel();
                         return;
                     }
                 }
             }
         }
         GraphDiagram.DeleteElement(diagramLayer, diagram, this.graphArrowToDelete);
         this.graphArrow = GraphDiagram.InsertArrow(this.diagram, this.diagramLayer, this.presentConnector, this.fixedConnector, this.conditionalOut, this.gridStatus);
     }
     else        //If you are modifying an item's prev
     {
         if (fixedConnector.Parent is GraphConditional)
         {
             if (((GraphConditional)fixedConnector.Parent).NextTrue == this.graphArrowToDelete)
             {
                 this.conditionalOut = ConditionalOut.True;
             }
             else
             {
                 this.conditionalOut = ConditionalOut.False;
             }
         }
         GraphDiagram.DeleteElement(this.diagramLayer, this.diagram, this.graphArrowToDelete);
         this.graphArrow = GraphDiagram.InsertArrow(this.diagram, this.diagramLayer, this.fixedConnector, this.presentConnector, this.conditionalOut, this.gridStatus);
     }
     foreach (GraphElement element in this.tempLayer.Elements)
     {
         element.DisableConnectors();
     }
     this.tempLayer.ClearAndHide();
     this.diagramLayer.UpdateSurface();
     if (this.OperationFinished != null)
     {
         this.OperationFinished(this, new OperationEventArgs(Operation.Reconnect));
     }
 }
예제 #4
0
 /// <summary>
 /// This method undos the operation
 /// </summary>
 public void Undo()
 {
     //The GraphElement of the diagram layer and the logical diagram is removed
     GraphDiagram.DeleteElement(this.diagramLayer, this.diagram, this.graphElement);
     //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());
     }
 }
예제 #5
0
        /// <summary>
        /// Execution of the operation
        /// </summary>
        public void Do()
        {
            GraphElement initialElement = this.initialConnector.Parent;
            GraphElement finalElement   = this.finalConnector.Parent;

            graphArrow = new GraphArrow(initialConnector, finalConnector, this.diagramLayer.GetGridPoints());
            if (initialElement is GraphConditional)
            {
                if ((this.conditionalOut == ConditionalOut.True) && (((GraphConditional)initialElement).NextTrue != null))
                {
                    if (DialogResult.Yes == MowayMessageBox.Show(InsertArrowMessages.REPLACE_TRUE + InsertArrowMessages.CONTINUE, InsertArrowMessages.INSERT_ARROW, MessageBoxButtons.YesNo, MessageBoxIcon.Warning))
                    {
                        this.graphArrowToDelete = (GraphArrow)((GraphConditional)initialElement).NextTrue;
                        GraphDiagram.DeleteElement(this.diagramLayer, this.diagram, this.graphArrowToDelete);
                    }
                    else
                    {
                        this.Cancel();
                        return;
                    }
                }
                else if ((this.conditionalOut == ConditionalOut.False) && (((GraphConditional)initialElement).NextFalse != null))
                {
                    if (DialogResult.Yes == MowayMessageBox.Show(InsertArrowMessages.REPLACE_FALSE + InsertArrowMessages.CONTINUE, InsertArrowMessages.INSERT_ARROW, MessageBoxButtons.YesNo, MessageBoxIcon.Warning))
                    {
                        this.graphArrowToDelete = (GraphArrow)((GraphConditional)initialElement).NextFalse;
                        GraphDiagram.DeleteElement(this.diagramLayer, this.diagram, this.graphArrowToDelete);
                    }
                    else
                    {
                        this.Cancel();
                        return;
                    }
                }
                ((GraphConditional)initialElement).AddNext(initialConnector, graphArrow, this.conditionalOut);
            }
            else
            {
                if (initialElement.Next != null)
                {
                    if (DialogResult.Yes == MowayMessageBox.Show(InsertArrowMessages.REPLACE_OUT + InsertArrowMessages.CONTINUE, InsertArrowMessages.INSERT_ARROW, MessageBoxButtons.YesNo, MessageBoxIcon.Warning))
                    {
                        this.graphArrowToDelete = (GraphArrow)initialElement.Next;
                        GraphDiagram.DeleteElement(this.diagramLayer, this.diagram, this.graphArrowToDelete);
                    }
                    else
                    {
                        this.Cancel();
                        return;
                    }
                }
                initialElement.AddNext(initialConnector, graphArrow);
            }
            finalElement.AddPrevious(finalConnector, graphArrow);
            this.diagramLayer.AddElement(graphArrow);
            //Elements in the context of the operation are deleted
            foreach (GraphElement element in this.tempLayer.Elements)
            {
                element.DisableConnectors();
            }
            this.tempLayer.ClearAndHide();
            this.diagramLayer.UpdateSurface();
            if (this.DiagramChanged != null)
            {
                this.DiagramChanged(this, new EventArgs());
            }
            if (this.OperationFinished != null)
            {
                this.OperationFinished(this, new OperationEventArgs(Operation.Connect));
            }
        }
예제 #6
0
        public void Do()
        {
            GraphElement initialElement = initialConnector.Parent;
            GraphElement finalElement   = finalConnector.Parent;

            this.graphArrow = new GraphArrow(initialConnector, finalConnector, gridStatus);
            if (initialElement is GraphConditional)
            {
                if ((conditionalOut == ConditionalOut.True) && (((GraphConditional)initialElement).NextTrue != null))
                {
                    if (DialogResult.Yes == MowayMessageBox.Show(InsertArrowMessages.REPLACE_TRUE + "\r\n" + InsertArrowMessages.CONTINUE, InsertArrowMessages.INSERT_ARROW, MessageBoxButtons.YesNo, MessageBoxIcon.Warning))
                    {
                        this.graphArrowToDelete = (GraphArrow)((GraphConditional)initialElement).NextTrue;
                        GraphDiagram.DeleteElement(diagramLayer, diagram, this.graphArrowToDelete);
                    }
                    else
                    {
                        this.Cancel();
                        return;
                    }
                }
                else if ((conditionalOut == ConditionalOut.False) && (((GraphConditional)initialElement).NextFalse != null))
                {
                    if (DialogResult.Yes == MowayMessageBox.Show(InsertArrowMessages.REPLACE_FALSE + "\r\n" + InsertArrowMessages.CONTINUE, InsertArrowMessages.INSERT_ARROW, MessageBoxButtons.YesNo, MessageBoxIcon.Warning))
                    {
                        this.graphArrowToDelete = (GraphArrow)((GraphConditional)initialElement).NextFalse;
                        GraphDiagram.DeleteElement(diagramLayer, diagram, this.graphArrowToDelete);
                    }
                    else
                    {
                        this.Cancel();
                        return;
                    }
                }
                ((GraphConditional)initialElement).AddNext(initialConnector, this.graphArrow, conditionalOut);
            }
            else
            {
                if (initialElement.Next != null)
                {
                    if (DialogResult.Yes == MowayMessageBox.Show(InsertArrowMessages.REPLACE_OUT + "\r\n" + InsertArrowMessages.CONTINUE, InsertArrowMessages.INSERT_ARROW, MessageBoxButtons.YesNo, MessageBoxIcon.Warning))
                    {
                        this.graphArrowToDelete = (GraphArrow)initialElement.Next;
                        GraphDiagram.DeleteElement(diagramLayer, diagram, this.graphArrowToDelete);
                    }
                    else
                    {
                        this.Cancel();
                        return;
                    }
                }
                initialElement.AddNext(initialConnector, this.graphArrow);
            }
            finalElement.AddPrevious(finalConnector, this.graphArrow);
            diagramLayer.AddElement(this.graphArrow);
            this.diagram.AddElement(this.graphArrow.Element);
            //Elements in the context of the operation are deleted
            this.PreCancel();
            this.diagramLayer.UpdateSurface();
            if (this.DiagramChanged != null)
            {
                this.DiagramChanged(this, new EventArgs());
            }
            if (this.OperationFinished != null)
            {
                this.OperationFinished(this, new OperationEventArgs(Operation.InsertArrow));
            }
        }