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; } }
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(); } }
public void UndoOrRedoTo(HistoryItemViewModel item) { TriggerInternalHistoryChange(() => UndoOrRedoToInternal(item)); UpdateSelectedIndexOnly(_historyItems.IndexOf(_historyItems.First(x => x.Action == item.Action)) + 1); }