Paradox Game Engine  v1.0.0 beta06
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Properties Events Macros Pages
CommandActionItem.cs
Go to the documentation of this file.
1 // Copyright (c) 2014 Silicon Studio Corp. (http://siliconstudio.co.jp)
2 // This file is distributed under GPL v3. See LICENSE.md for details.
3 using System.Collections.Generic;
4 
5 using SiliconStudio.ActionStack;
6 using SiliconStudio.Presentation.ViewModel;
7 using SiliconStudio.Presentation.ViewModel.ActionStack;
8 
9 namespace SiliconStudio.Presentation.Commands
10 {
12  {
13  private CancellableCommand command;
14  private object parameter;
15  private UndoToken undoToken;
16 
17  public CommandActionItem(CancellableCommand command, object parameter, UndoToken undoToken, IEnumerable<IDirtiableViewModel> dirtiables)
18  : base("Executing " + command.Name, dirtiables)
19  {
20  this.command = command;
21  this.parameter = parameter;
22  this.undoToken = undoToken;
23  }
24 
25  public CancellableCommand Command { get { return command; } }
26 
27  protected override void FreezeMembers()
28  {
29  command = null;
30  parameter = null;
31  undoToken = default(UndoToken);
32  }
33 
34  protected override void UndoAction()
35  {
36  command.UndoCommand(parameter, undoToken);
37  }
38 
39  protected override void RedoAction()
40  {
41  command.ExecuteCommand(parameter, false);
42  }
43  }
44 }
CommandActionItem(CancellableCommand command, object parameter, UndoToken undoToken, IEnumerable< IDirtiableViewModel > dirtiables)
override void RedoAction()
Invoked by Redo after setting IsDone to true.
An abstact class that inherits from ActionItem and can be used to manage actions related to an IDirti...
override void UndoAction()
Invoked by Undo after setting IsDone to true.
override void FreezeMembers()
Invoked by Freeze before setting IsFrozen to true.
Represents a token that stores an unique identifier and an object. This token should be generated by ...
Definition: UndoToken.cs:12