Beispiel #1
0
 /// <summary>
 /// 添加可撤消的动作
 /// </summary>
 /// <param name="p_action"></param>
 public void RecordAction(CmdAction p_action)
 {
     if (_undoStack.Count > _depth)
     {
         _undoStack.Pop();
     }
     _undoStack.Push(p_action);
     _redoStack.Clear();
     OnCmdChanged();
 }
Beispiel #2
0
 /// <summary>
 /// 执行重做操作
 /// </summary>
 public void Redo()
 {
     if (CanRedo)
     {
         CmdAction action = _redoStack.Pop();
         action.Redo();
         if (_undoStack.Count < _depth)
         {
             _undoStack.Push(action);
         }
         OnCmdChanged();
     }
     else
     {
         Kit.Msg("无操作可重做!");
     }
 }
Beispiel #3
0
 /// <summary>
 /// 执行撤消操作
 /// </summary>
 public void Undo()
 {
     if (CanUndo)
     {
         CmdAction action = _undoStack.Pop();
         action.Undo();
         if (_redoStack.Count < _depth)
         {
             _redoStack.Push(action);
         }
         OnCmdChanged();
     }
     else
     {
         Kit.Msg("没有可撤消的操作!");
     }
 }