4 using System.Collections.Generic;
6 using SiliconStudio.ActionStack;
7 using SiliconStudio.Presentation.ViewModel;
8 using SiliconStudio.Quantum;
10 namespace SiliconStudio.Presentation.Quantum
15 private readonly
string name;
17 private readonly Func<object, UndoToken> redo;
18 private readonly Action<object, UndoToken> undo;
30 : base(serviceProvider, dirtiables)
32 if (name == null)
throw new ArgumentNullException(
"name");
33 if (redo == null)
throw new ArgumentNullException(
"redo");
34 if (undo == null)
throw new ArgumentNullException(
"undo");
36 this.combineMode = combineMode;
43 public override string Name {
get {
return name; } }
49 public override void Execute(
object parameter)
51 actionStack.BeginTransaction();
52 base.Execute(parameter);
53 actionStack.EndTransaction(string.Format(
"Executing {0}", Name));
57 protected override UndoToken Redo(
object parameter,
bool creatingActionItem)
59 return redo(parameter);
65 undo(parameter, token);
override void Execute(object parameter)
AnonymousCommandWrapper(IViewModelServiceProvider serviceProvider, string name, CombineMode combineMode, Func< object, UndoToken > redo, Action< object, UndoToken > undo, IEnumerable< IDirtiableViewModel > dirtiables)
Initializes a new instance of the AnonymousCommandWrapper class.
A service provider class for view model objects.
override UndoToken Redo(object parameter, bool creatingActionItem)
Does or redoes the execution of the command. The command parameter.Indicates whether an action item i...
CombineMode
An enum that describes what to do with a node or a command when combining view models.
A base class to wrap one or multiple INodeCommand instances into a CancellableCommand.
override void Undo(object parameter, UndoToken token)
Undoes the execution of the command. The command parameter.The UndoToken generated by the execution o...
Represents a token that stores an unique identifier and an object. This token should be generated by ...
Base interface for a transactional action stack.