Пример #1
0
        private void DoAction(SortAction action)
        {
            action.Do();
            doneActions.Push(action);
            undoneActions.Clear();

            form.ValidateChildren();
        }
Пример #2
0
        /// <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);
        }