protected override UndoToken Redo(object parameter, bool creatingActionItem) { UndoToken token; object index; var modelNode = NodePath.GetSourceNode(out index); if (modelNode == null) { throw new InvalidOperationException("Unable to retrieve the node on which to apply the redo operation."); } var currentValue = modelNode.GetValue(index); var newValue = NodeCommand.Invoke(currentValue, parameter, out token); modelNode.SetValue(newValue, index); Refresh(modelNode, index); var additionalToken = new UndoToken(); if (AdditionalCommand != null) { additionalToken = AdditionalCommand.ExecuteCommand(null, false); } return(new UndoToken(token.CanUndo, new ModelNodeToken(token, additionalToken))); }
/// <inheritdoc/> protected override void UndoAction() { object pathIndex; var node = NodePath.GetSourceNode(out pathIndex); if (node == null) { throw new InvalidOperationException("Unable to retrieve the node to modify in this undo process."); } var currentValue = node.GetValue(Index); bool setByObservableNode = false; var observableNode = service.ResolveObservableNode(identifier, ObservableNodePath) as SingleObservableNode; if (observableNode != null) { observableNode.Value = PreviousValue; setByObservableNode = true; } if (!setByObservableNode) { node.SetValue(PreviousValue, Index); } PreviousValue = currentValue; }