示例#1
0
        public void UndoOrRedoTo(HistoryItemViewModel item, bool setSelectedIndex)
        {
            switch (item.ItemType)
            {
            case HistoryItemType.InitialState:
                _undoRedoManager.UndoAll();
                break;

            case HistoryItemType.Undo:
                _undoRedoManager.UndoTo(item.Action);
                break;

            case HistoryItemType.Current:
                break;

            case HistoryItemType.Redo:
                _undoRedoManager.RedoTo(item.Action);
                break;

            default:
                throw new ArgumentOutOfRangeException();
            }

            if (setSelectedIndex)
            {
                SelectedIndex = HistoryItems.IndexOf(item) + 1;
            }
        }
示例#2
0
        private void UndoOrRedoToInternal(HistoryItemViewModel item)
        {
            switch (item.ItemType)
            {
            case HistoryItemType.InitialState:
                _undoRedoManager.UndoAll();
                break;

            case HistoryItemType.Undo:
                _undoRedoManager.UndoTo(item.Action);
                break;

            case HistoryItemType.Current:
                break;

            case HistoryItemType.Redo:
                _undoRedoManager.RedoTo(item.Action);
                break;

            default:
                throw new ArgumentOutOfRangeException();
            }
        }