Ejemplo n.º 1
0
        public IUndoUnit UseRedo()
        {
            IUndoUnit obj = null;

            if (_currentItem != null)
            {
                if (_position == EnumUndoStackPosition.AtRedo)
                {
                    if (_currentItem.Previous != null)
                    {
                        _currentItem = _currentItem.Previous;
                        obj          = _currentItem.Value.RedoObject;
                    }
                }
                else
                {
                    obj       = _currentItem.Value.RedoObject;
                    _position = EnumUndoStackPosition.AtRedo;
                }
            }
            return(obj);
        }
Ejemplo n.º 2
0
        public IUndoUnit UseUndo()
        {
            IUndoUnit obj = null;

            if (_currentItem != null)
            {
                if (_position == EnumUndoStackPosition.AtRedo)
                {
                    obj       = _currentItem.Value.UndoObject;
                    _position = EnumUndoStackPosition.AtUndo;
                }
                else
                {
                    if (_currentItem.Next != null)
                    {
                        _currentItem = _currentItem.Next;
                        obj          = _currentItem.Value.UndoObject;
                    }
                }
            }
            return(obj);
        }
Ejemplo n.º 3
0
 public void AddUndoEntity(UndoEntity entity)
 {
     cutoff();
     if (_currentItem != null)
     {
         if (_position == EnumUndoStackPosition.AtUndo)
         {
             RemoveFirst();
         }
         else
         {
             if (entity.UndoObject is SizeUndo && _currentItem.Value.UndoObject is SizeUndo)
             {
                 if (((SizeUndo)entity.UndoObject).Key == ((SizeUndo)_currentItem.Value.UndoObject).Key)
                 {
                     RemoveFirst();
                 }
             }
         }
     }
     this.AddFirst(entity);
     _currentItem = this.First;
     _position    = EnumUndoStackPosition.AtRedo;
 }