コード例 #1
0
        /// <summary>
        /// Undoes the last done command
        /// </summary>
        internal void Undo()
        {
            if (DoneCommands.Count == 0)
            {
                return;
            }

            D_Command c = DoneCommands.Pop();

            c.ExecuteReverse();
            UndoneCommands.Push(c);
        }
コード例 #2
0
        /// <summary>
        /// Redoes the last undone command
        /// </summary>
        internal void Redo()
        {
            if (UndoneCommands.Count == 0)
            {
                return;
            }

            D_Command c = UndoneCommands.Pop();

            c.Execute();
            DoneCommands.Push(c);
        }
コード例 #3
0
 private void DoCommand(D_Command c)
 {
     UndoRedoC.Do(c);
     UpdateUndoRedoCommands();
 }
コード例 #4
0
 /// <summary>
 /// Execute a command for the first time
 /// </summary>
 /// <param name="c">The new command</param>
 internal void Do(D_Command c)
 {
     c.Execute();
     DoneCommands.Push(c);
     UndoneCommands.Clear();
 }