Пример #1
0
        internal void StartUndoGroup(String description)
        {
            UndoGroup ug = new UndoGroup(this, description);

            _currentUndoGroup = ug;
            _actions.Push(ug);
        }
Пример #2
0
        internal void EndUndoGroup(bool keepChanges)
        {
            if (_currentUndoGroup == null)
            {
                return;
            }

            // group contains no items; or user doesn't want changes to part of undo
            //
            if (_currentUndoGroup.Count == 0 || !keepChanges)
            {
                UndoGroup ug = _actions.Pop() as UndoGroup;                     // get rid of the empty group
                if (ug != _currentUndoGroup)
                {
                    throw new Exception("Internal logic error: EndGroup doesn't match StartGroup");
                }
            }
            _currentUndoGroup = null;
        }