Exemplo n.º 1
0
 private void ClearRedoStack()
 {
     if (InternalRedoStack.Count > 0)
     {
         InternalRedoStack.Clear();
         OnPropertyChanged(new PropertyChangedEventArgs("CanRedo"));
     }
 }
Exemplo n.º 2
0
        void EnforceSizeLimit()
        {
            AssertNoUndoGroupOpen();
            while (InternalUndoStack.Count > _sizeLimit)
            {
                InternalUndoStack.DequeueTail();
            }

            while (InternalRedoStack.Count > _sizeLimit)
            {
                InternalRedoStack.DequeueTail();
            }
        }
Exemplo n.º 3
0
        /// <summary>
        /// Redoes the last undone operation.
        /// </summary>
        public void Redo()
        {
            AssertNoUndoGroupOpen();
            if (InternalRedoStack.Count > 0)
            {
                IUndoableOperation operation = InternalRedoStack.DequeueHead();
                InternalUndoStack.EnqueueHead(operation);
                operation.Do();
                OnOperationRedone();

                if (InternalRedoStack.Count == 0)
                {
                    OnPropertyChanged(new PropertyChangedEventArgs("CanRedo"));
                }

                if (InternalUndoStack.Count == 1)
                {
                    OnPropertyChanged(new PropertyChangedEventArgs("CanUndo"));
                }

                EnforceSizeLimit();
            }
        }