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); }
public void Init() { undo = new UndoManager(); operation = Substitute.For<IUndoOperation>(); eventFired = false; }
public void Add(IUndoOperation undoOperation) { _undoStack.Push(undoOperation); OnPropertyChanged(""); }
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(); } }
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(); }
private void Do(IUndoOperation operation, bool clearUndone) { operation.Do(); operations.Enqueue(operation); if(clearUndone) operationsUndone.Clear(); OperationDone(this, operation); }
public void Do(IUndoOperation operation) { Do(operation, clearUndone: true); }
public void OnUndoRedoEvent(object sender, IUndoOperation operation) { HasUnsavedChanges = UndoManager.HasUndoneOperations; }
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; } }