Exemplo n.º 1
0
        public SvgElement[] Redo()
        {
            ArrayList list1 = new ArrayList(0x10);

            if (this.redostack.Count > 0)
            {
                IUndoOperation[] operationArray1 = (IUndoOperation[])this.redostack.Pop();
                this.AcceptChanges = false;
                IUndoOperation[] operationArray2 = operationArray1;
                for (int num1 = 0; num1 < operationArray2.Length; num1++)
                {
                    IUndoOperation operation1 = operationArray2[num1];
                    SvgElement     element1   = null;
                    if (operation1 is UnDoOperation)
                    {
                        element1 = ((UnDoOperation)operation1).changeParent;
                    }
                    else if (operation1 is KeyUndoOperation)
                    {
                        element1 = ((KeyUndoOperation)operation1).ChangeElement;
                    }
                    if (!list1.Contains(element1))
                    {
                        list1.Add(element1);
                    }
                    operation1.Redo();
                }
                Array.Reverse(operationArray1);
                this.undostack.Push(operationArray1);
                this.OnActionRedone();
                this.AcceptChanges = true;
            }
            if (list1.Count > 0)
            {
                SvgElement[] elementArray1 = new SvgElement[list1.Count];
                list1.CopyTo(elementArray1);
                return(elementArray1);
            }
            return(null);
        }
Exemplo n.º 2
0
 public void Init()
 {
     undo = new UndoManager();
     operation = Substitute.For<IUndoOperation>();
     eventFired = false;
 }
Exemplo n.º 3
0
 public void Add(IUndoOperation undoOperation)
 {
     _undoStack.Push(undoOperation);
     OnPropertyChanged("");
 }
Exemplo n.º 4
0
 public void PushUndo(IUndoOperation undo)
 {
     if (this.undoGroup.Count == 0)
     {
         this.undoGroup.Add(undo);
     }
     else
     {
         this.undoGroup.Insert(0, undo);
     }
     if (this.undoGroup.Count == this.NumberOfUndoOperations)
     {
         IUndoOperation[] operationArray1 = new IUndoOperation[this.undoGroup.Count];
         this.undoGroup.CopyTo(operationArray1, 0);
         this.undoGroup.Clear();
         this.NumberOfUndoOperations = 1;
         if (operationArray1.Length >= 1)
         {
             this.undoStack.Push(operationArray1);
         }
         this.ChangeElements.Clear();
     }
 }
Exemplo n.º 5
0
 public void NotifyUndo()
 {
     IUndoOperation[] operationArray1 = new IUndoOperation[this.undoGroup.Count];
     this.undoGroup.CopyTo(operationArray1, 0);
     this.undoGroup.Clear();
     this.NumberOfUndoOperations = 1;
     if (operationArray1.Length >= 1)
     {
         this.undoStack.Push(operationArray1);
     }
     this.ChangeElements.Clear();
 }
Exemplo n.º 6
0
        private void Do(IUndoOperation operation, bool clearUndone)
        {
            operation.Do();
            operations.Enqueue(operation);

            if(clearUndone)
                operationsUndone.Clear();

            OperationDone(this, operation);
        }
Exemplo n.º 7
0
 public void Do(IUndoOperation operation)
 {
     Do(operation, clearUndone: true);
 }
Exemplo n.º 8
0
 public void OnUndoRedoEvent(object sender, IUndoOperation operation)
 {
     HasUnsavedChanges = UndoManager.HasUndoneOperations;
 }
Exemplo n.º 9
0
 public void Push(IUndoOperation[] operations)
 {
     if (operations == null)
     {
         throw new ArgumentNullException("�ն�ջ��");
     }
     if (this.AcceptChanges)
     {
         this.AcceptChanges = false;
         this.undostack.Push(operations);
         this.ClearRedoStack();
         this.AcceptChanges = true;
     }
 }