3 using System.Collections.Generic;
5 using SiliconStudio.ActionStack;
6 using SiliconStudio.Presentation.ViewModel;
8 namespace SiliconStudio.Presentation.
Commands
24 : base(serviceProvider)
27 this.dirtiables = dirtiables;
33 public abstract string Name {
get; }
36 public override void Execute(
object parameter)
38 ExecuteCommand(parameter,
true);
48 Undo(parameter, token);
61 if (transactionalActionStack != null)
62 transactionalActionStack.BeginTransaction();
64 UndoToken token = Redo(parameter, createActionItem);
66 if (transactionalActionStack != null)
67 transactionalActionStack.DiscardTransaction();
69 if (token.CanUndo && createActionItem)
72 actionStack.Add(actionItem);
83 protected abstract UndoToken Redo(
object parameter,
bool creatingActionItem);
90 protected abstract void Undo(
object parameter,
UndoToken token);
UndoToken ExecuteCommand(object parameter, bool createActionItem)
Executes the command and return a token that can be used to undo it.
A command that supports undo/redo
A service provider class for view model objects.
override void Execute(object parameter)
Base interface to for an action stack.
void UndoCommand(object parameter, UndoToken token)
Undoes the execution of this command.
An abstract class that is the base implementation of the ICommandBase interface.
CancellableCommand(IViewModelServiceProvider serviceProvider, IEnumerable< IDirtiableViewModel > dirtiables)
Initializes a new instance of the CancellableCommand class.
Represents a token that stores an unique identifier and an object. This token should be generated by ...
Base interface for a transactional action stack.