Paradox Game Engine  v1.0.0 beta06
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Properties Events Macros Pages
NullTransactionalActionStack.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 using System.Linq;
6 
7 using SiliconStudio.Core;
8 
9 namespace SiliconStudio.ActionStack
10 {
11  /// <summary>
12  /// An implementation of the <see cref="ITransactionalActionStack"/> that does not store any action item and does not trigger any event.
13  /// </summary>
14  /// <remarks>This class can be used when an action stack is required by some objects but you don't need the action stack yourself. Use the <see cref="Default"/> instance of this class.</remarks>
16  {
17  /// <summary>
18  /// The single instance of the <see cref="NullTransactionalActionStack"/>.
19  /// </summary>
21 
22  /// <summary>
23  /// Initializes a new instance of the <see cref="NullTransactionalActionStack"/> class.
24  /// </summary>
26  {
27 
28  }
29 
30  /// <inheritdocs/>
31  public IDisposable BeginEndTransaction(string name)
32  {
33  return new NullDisposable();
34  }
35 
36  /// <inheritdocs/>
37  public IDisposable BeginEndTransaction(Func<string> getName)
38  {
39  return new NullDisposable();
40  }
41 
42  /// <inheritdocs/>
43  public IDisposable BeginCancelTransaction()
44  {
45  return new NullDisposable();
46  }
47 
48  /// <inheritdocs/>
49  public IDisposable BeginDiscardTransaction()
50  {
51  return new NullDisposable();
52  }
53 
54  /// <inheritdocs/>
55  public void BeginTransaction()
56  {
57  }
58 
59  /// <inheritdocs/>
60  public void EndTransaction(string displayName)
61  {
62  }
63 
64  /// <inheritdocs/>
65  public void EndTransaction(string displayName, Func<IReadOnlyCollection<IActionItem>, IActionItem> aggregateActionItems)
66  {
67  }
68 
69  /// <inheritdocs/>
70  public void CancelTransaction()
71  {
72  }
73 
74  /// <inheritdocs/>
75  public void DiscardTransaction()
76  {
77  }
78 
79  /// <inheritdocs/>
80  public IEnumerable<IActionItem> ActionItems
81  {
82  get { return Enumerable.Empty<IActionItem>(); }
83  }
84 
85  // The following events are intentionally never invoked.
86 #pragma warning disable 67
87 
88  /// <inheritdocs/>
89  public event EventHandler<ActionItemsEventArgs<IActionItem>> ActionItemsAdded;
90 
91  /// <inheritdocs/>
92  public event EventHandler ActionItemsCleared;
93 
94  /// <inheritdocs/>
95  public event EventHandler<DiscardedActionItemsEventArgs<IActionItem>> ActionItemsDiscarded;
96 
97  /// <inheritdocs/>
98  public event EventHandler<ActionItemsEventArgs<IActionItem>> Undone;
99 
100  /// <inheritdocs/>
101  public event EventHandler<ActionItemsEventArgs<IActionItem>> Redone;
102 
103 #pragma warning restore 67
104 
105  /// <inheritdocs/>
106  public void Add(IActionItem item)
107  {
108  }
109 
110  /// <inheritdocs/>
112  {
113  }
114 
115  /// <inheritdocs/>
116  public void Clear()
117  {
118  }
119 
120  /// <inheritdocs/>
121  public SavePoint CreateSavePoint(bool markActionsAsSaved)
122  {
123  return SavePoint.Empty;
124  }
125 
126  /// <inheritdocs/>
127  public bool Undo()
128  {
129  return false;
130  }
131 
132  /// <inheritdocs/>
133  public bool Redo()
134  {
135  return false;
136  }
137  }
138 }
Represents a save point marker in the undo/redo action items stack.
Definition: SavePoint.cs:11
EventHandler< ActionItemsEventArgs< IActionItem > > Undone
An implementation of the ITransactionalActionStack that does not store any action item and does not t...
EventHandler< ActionItemsEventArgs< IActionItem > > ActionItemsAdded
EventHandler< ActionItemsEventArgs< IActionItem > > Redone
EventHandler< DiscardedActionItemsEventArgs< IActionItem > > ActionItemsDiscarded
Use the default mode depending on the type of the field/property.
This class is an implementation of the IDisposable interface that does nothing when disposed...
Base interface for action items.
Definition: IActionItem.cs:10
void EndTransaction(string displayName, Func< IReadOnlyCollection< IActionItem >, IActionItem > aggregateActionItems)
Base interface for a transactional action stack.