Paradox Game Engine  v1.0.0 beta06
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Properties Events Macros Pages
PropertyChangedViewModelActionItem.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;
4 using System.Collections.Generic;
5 
6 using SiliconStudio.ActionStack;
7 
8 namespace SiliconStudio.Presentation.ViewModel.ActionStack
9 {
11  {
12  private readonly PropertyChangedActionItem innerActionItem;
13 
14  public PropertyChangedViewModelActionItem(string name, object container, IEnumerable<IDirtiableViewModel> dirtiables, string propertyName, object previousValue)
15  : base(name, dirtiables)
16  {
17  if (propertyName == null) throw new ArgumentNullException("propertyName");
18  innerActionItem = new PropertyChangedActionItem(propertyName, container, previousValue);
19  }
20 
21  /// <summary>
22  /// Gets the name of the property affected by the change.
23  /// </summary>
24  public string PropertyName { get { return innerActionItem.PropertyName; } }
25 
26  /// <inheritdoc/>
27  protected override void FreezeMembers()
28  {
29  innerActionItem.Freeze();
30  }
31 
32  /// <inheritdoc/>
33  protected override void UndoAction()
34  {
35  innerActionItem.Undo();
36  }
37 
38  /// <inheritdoc/>
39  protected override void RedoAction()
40  {
41  // Once we have un-done, the previous value is updated so Redo is just Undoing the Undo
42  UndoAction();
43  }
44  }
45 }
An abstact class that inherits from ActionItem and can be used to manage actions related to an IDirti...
This class represents a thread-safe stack of action items that can be undone/redone.
Definition: ActionStack.cs:12
PropertyChangedViewModelActionItem(string name, object container, IEnumerable< IDirtiableViewModel > dirtiables, string propertyName, object previousValue)
override void FreezeMembers()
Invoked by Freeze before setting IsFrozen to true. This method will not be invoked if IsFrozen is alr...