コード例 #1
0
        UnitResult Undo()
        {
            if (globallyRepeatableUnits.Count < 1)
            {
                throw new InvalidOperationException("No unit to undo.");
            }

            IUndoableUnit undoableUnit   = globallyUndoableUnits.Pop();
            IInternalUnit repeatableUnit = globallyRepeatableUnits.Pop();

            var eventArgs = new CancellableUndoServiceEventArgs(undoableUnit);

            OnUndoing(eventArgs);
            if (eventArgs.Cancel)
            {
                globallyUndoableUnits.AddLast(undoableUnit);
                globallyRepeatableUnits.AddLast(repeatableUnit);
                return(UnitResult.Cancelled);
            }

            globallyRedoableUnits.AddLast(undoableUnit);

            UnitResult result = undoableUnit.Undo();

            OnUndone(new UndoServiceEventArgs(undoableUnit));
            return(result);
        }
コード例 #2
0
 void IInternalUndoService.NotifyUnitRepeatableChanged(IInternalUnit unit)
 {
     /* Here we should notify listeners that a unit has changed its repeatable property.
      * This will prompt repopulation of any Repeatable unit lists etc. */
 }