예제 #1
0
        public void SaveAndExecute(UndoRedoAction a_action)
        {
            if (IsInUndoRedo)
            {
                throw new Exception();
            }

            if (m_action_index < m_actions.Count - 1)
            {
                m_actions.RemoveRange(m_action_index + 1, m_actions.Count - (m_action_index + 1));
            }

            a_action.UndoState.Save();
            m_actions.Add(a_action);
            m_action_index++;

            if (m_actions.Count > UndoRedoConfiguration.UndoRedo_MaxDeep)
            {
                m_actions = m_actions.Skip(m_actions.Count - UndoRedoConfiguration.UndoRedo_MaxDeep).
                            Take(UndoRedoConfiguration.UndoRedo_MaxDeep).ToList();
            }

            OnChanged();

            CurrentAction.Redo();
        }
예제 #2
0
    public void Redo()
    {
        if (CurrentAction == null)
        {
            return;
        }

        CurrentAction.Redo();
        index++;
    }