Exemplo n.º 1
0
        public void AddAction( UndoableAction action )
        {
            if( action == null )
            {
                throw new ArgumentNullException( "action" );
            }

            _actions.Add( action );
        }
Exemplo n.º 2
0
        public void AddAction( UndoableAction action )
        {
            if( action == null )
            {
                throw new ArgumentNullException( "action" );
            }
            if( _changing.IsActive )
            {
                return;
            }

            if( _composites.Count > 0 )
            {
                CompositeUndoableAction composite = _composites.Peek();

                composite.AddAction( action );
            }
            else
            {
                _actions.RemoveRange( _position, _actions.Count - _position );
                _actions.Add( action );

                if( _actions.Count > _maxItems )
                {
                    _actions.RemoveAt( 0 );
                }

                _position = _actions.Count;

                OnChanged( EventArgs.Empty );
            }
        }