Paradox Game Engine  v1.0.0 beta06
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Properties Events Macros Pages
UncancellableCommand.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 
5 using SiliconStudio.ActionStack;
6 using SiliconStudio.Core.Reflection;
7 
8 namespace SiliconStudio.Quantum.Commands
9 {
10  public abstract class UncancellableCommand : INodeCommand
11  {
12  /// <inheritdoc/>
13  public abstract string Name { get; }
14 
15  /// <inheritdoc/>
16  public abstract CombineMode CombineMode { get; }
17 
18  /// <inheritdoc/>
19  public abstract bool CanAttach(ITypeDescriptor typeDescriptor, MemberDescriptorBase memberDescriptor);
20 
21  public object Invoke(object currentValue, ITypeDescriptor descriptor, object parameter, out UndoToken undoToken)
22  {
23  undoToken = new UndoToken(false);
24  InvokeUncancellable(currentValue, descriptor, parameter);
25  return currentValue;
26  }
27 
28  public object Undo(object currentValue, ITypeDescriptor descriptor, UndoToken undoToken)
29  {
30  throw new NotSupportedException("This command is not cancellable.");
31  }
32 
33  protected abstract void InvokeUncancellable(object currentValue, ITypeDescriptor descriptor, object parameter);
34  }
35 }
object Invoke(object currentValue, ITypeDescriptor descriptor, object parameter, out UndoToken undoToken)
Invokes the node command.
object Undo(object currentValue, ITypeDescriptor descriptor, UndoToken undoToken)
Undoes an invoke of the node command.
CombineMode
An enum that describes what to do with a node or a command when combining view models.
Definition: CombineMode.cs:8
Base interface for node commands.
Definition: INodeCommand.cs:11
Provides access members of a type.
Base class for IMemberDescriptor for a MemberInfo
Represents a token that stores an unique identifier and an object. This token should be generated by ...
Definition: UndoToken.cs:12