public void TestPop() { _testStack.Push(1); _testStack.Push(2); _hasItemsChangedFiredCount = 0; _testStack.Pop(); Assert.IsTrue(_hasItemsChangedFiredCount == 0); _testStack.Pop(); Assert.IsTrue(_hasItemsChangedFiredCount == 1); }
void Undo() { if (inverseCommands.Count == 0) { return; } inverseCommands.Pop().Excecute(); }
public void Undo() { var action = undoStack.Pop(); if (action == null) { return; } redoStack.Push(action); action.Undo(); }
public void Redo() { var action = redoStack.Pop(); if (action == null) { return; } undoStack.Push(action); action.Do(); }
private void RevertOriginalImage(object sender, RoutedEventArgs e) { Do(() => { if (bitmapsBuffer.HasElements) { image.Source = bitmapsBuffer.Pop(); SetUndoVisibility(); SetToDefaultVisibility(); } }); }
public void Start() { Console.WriteLine("===========DropoutStack Demo=========="); int stackCapacity = 5; int inputCount = 4; DropoutStack <int> stack = new DropoutStack <int>(stackCapacity); for (int i = 0; i < inputCount; i++) { stack.Push(i); } while (stack.Count > 0) { Console.WriteLine(stack.Pop()); } }