private void DoAction(SortAction action) { action.Do(); doneActions.Push(action); undoneActions.Clear(); form.ValidateChildren(); }
/// <summary> /// Pop an action from the undoneActions stack and exeucutes it. Returns false if there was no action on the stack to redo. /// </summary> public bool Redo() { if (undoneActions.Count > 0) { SortAction action = undoneActions.Pop(); action.Do(); if (action.Successful) { doneActions.Push(action); } form.ValidateChildren(); return(true); } return(false); }