Beispiel #1
0
        /// <summary>
        /// Restore the state of some models to after the current <see cref="IUndoableEdit"/>.
        /// </summary>
        /// <remarks>
        /// This calls <see cref="IUndoableEdit.Redo"/> on the current <see cref="EditToRedo"/>.
        /// This will raise a <see cref="IDiagramModel.Changed"/> event with a hint of
        /// <see cref="ModelChange.StartingRedo"/> before actually performing the redo, and will raise a
        /// Changed event with a hint of <see cref="ModelChange.FinishedRedo"/> afterwards.
        /// The <see cref="ModelChangedEventArgs.Data"/>
        /// is the <see cref="UndoManager.CompoundEdit"/> that was the value of
        /// <see cref="EditToRedo"/> before calling Redo.
        /// </remarks>
        /// <seealso cref="CanRedo"/>
        public virtual void Redo()
        {
            if (!CanRedo())
            {
                return;
            }
            IUndoableEdit edit = this.EditToRedo;

            try {
                foreach (IDiagramModel model in this.ModelsList)
                {
                    RaiseChanged(model, ModelChange.StartingRedo, edit, null, null);
                }
                this.IsUndoingRedoing = true;
                this.UndoEditIndex++;
                edit.Redo();
            } catch (Exception ex) {
                ModelHelper.Trace("Redo: " + ex.ToString());
                throw;
            } finally {
                this.IsUndoingRedoing = false;
                foreach (IDiagramModel model in this.ModelsList)
                {
                    RaiseChanged(model, ModelChange.FinishedRedo, edit, null, null);
                }
            }
        }
Beispiel #2
0
 public virtual void Redo()
 {
     if (this.CanRedo())
     {
         try
         {
             this.myIsRedoing = true;
             IUndoableEdit edit1 = this.EditToRedo;
             this.myCurrentEditIndex++;
             edit1.Redo();
             foreach (DiagramDocument document1 in this.Documents)
             {
                 document1.InvalidateViews();
             }
         }
         catch (Exception exception1)
         {
             Shapes.DiagramShape.Trace("Redo: " + exception1.ToString());
             throw exception1;
         }
         finally
         {
             this.myIsRedoing = false;
         }
     }
 }
Beispiel #3
0
        /**
         * Redoes all changes from indexOfNextAdd to edit. Updates indexOfNextAdd accordingly.
         */
        protected void RedoTo(IUndoableEdit edit)
        {
            bool done = false;

            while (!done)
            {
                IUndoableEdit next = edits[indexOfNextAdd++];
                next.Redo();
                done = next == edit;
            }
        }
Beispiel #4
0
 public virtual void Redo()
 {
     if (this.CanRedo())
     {
         for (int num1 = 0; num1 <= (this.myEdits.Count - 1); num1++)
         {
             IUndoableEdit edit1 = (IUndoableEdit)this.myEdits[num1];
             edit1.Redo();
         }
     }
 }
Beispiel #5
0
 protected void RedoTo(IUndoableEdit e)
 {
     while (true)
     {
         IUndoableEdit edit = edits[index++];
         edit.Redo();
         if (edit == e)
         {
             return;
         }
     }
 }
Beispiel #6
0
 /// <summary>
 /// Redo all of the <see cref="IUndoableEdit"/>s, in forwards order.
 /// </summary>
 public void Redo()
 {
     if (CanRedo())
     {
         for (int i = 0; i <= this.Edits.Count - 1; i++)
         {
             IUndoableEdit edit = this.Edits[i];
             if (edit != null)
             {
                 edit.Redo();
             }
         }
     }
 }
        public void ApplyRiskLevelToChildrenTest()
        {
            effect1 = new Effect(structure);
            StateObjectManager rlm = new StateObjectManager(effect1);

            eq11.AddEffect(effect1);
            IUndoableEdit edit = rlm.ChangeState(State.FAULTY);

            Assert.AreEqual(State.FAULTY, eq11.CurrentState);
            Assert.IsFalse(dep.Combinations.Contains(combi1));

            ((CompoundEdit)edit).EndAllEdits();
            edit.Undo();
            Assert.AreNotEqual(State.FAULTY, eq11.CurrentState);
            Assert.IsTrue(dep.Combinations.Contains(combi1));
            edit.Redo();
        }
        public void ApplyRiskLevelToChildrenTest()
        {
            effect1 = new Effect(structure);
            RiskLevelManager rlm = new RiskLevelManager(effect1);

            eq11.AddEffect(effect1);
            effect1.RiskLevel = 6;
            IUndoableEdit edit = rlm.ApplyRiskLevelToChildren();

            Assert.AreEqual(6, eq11.RiskLevel);
            Assert.AreEqual(6, combi2.RiskLevel);
            Assert.AreEqual(6, combi1.RiskLevel);
            Assert.AreEqual(6, test1.RiskLevel);
            ((CompoundEdit)edit).EndAllEdits();
            edit.Undo();
            Assert.AreNotEqual(6, eq11.RiskLevel);
            Assert.AreNotEqual(6, combi2.RiskLevel);
            Assert.AreNotEqual(6, combi1.RiskLevel);
            Assert.AreNotEqual(6, test1.RiskLevel);
            edit.Redo();
        }