Gorgon
Show / Hide Table of Contents

Interface IUndoService

The service used to supply undo/redo functionality.

Namespace: Gorgon.Editor.Services
Assembly: Gorgon.Editor.API.dll
Syntax
public interface IUndoService

Properties

| Edit this page View Source

CanRedo

Property to return whether or not the service can redo.

Declaration
bool CanRedo { get; }
Property Value
Type Description
bool
| Edit this page View Source

CanUndo

Property to return whether or not the service can undo.

Declaration
bool CanUndo { get; }
Property Value
Type Description
bool
| Edit this page View Source

UndoItems

Property to return the undo items in the undo stack.

Declaration
IEnumerable<string> UndoItems { get; }
Property Value
Type Description
IEnumerable<string>

Methods

| Edit this page View Source

Cancel()

Function to cancel the currently executing undo/redo operation.

Declaration
void Cancel()
| Edit this page View Source

ClearStack()

Function to clear the undo/redo stacks.

Declaration
void ClearStack()
| Edit this page View Source

Record<TU, TR>(string, Func<TU, CancellationToken, Task>, Func<TR, CancellationToken, Task>, TU, TR)

Function to record an undo/redo state.

Declaration
void Record<TU, TR>(string desc, Func<TU, CancellationToken, Task> undoAction, Func<TR, CancellationToken, Task> redoAction, TU undoArgs, TR redoArgs) where TU : class where TR : class
Parameters
Type Name Description
string desc

The description of the action being recorded.

Func<TU, CancellationToken, Task> undoAction

The action to execute when undoing.

Func<TR, CancellationToken, Task> redoAction

The action to execute when redoing.

TU undoArgs

The parameters to pass to the undo operation.

TR redoArgs

The parameters to pass to the redo oprtation.

Type Parameters
Name Description
TU

The type of undo parameters to pass. Must be a reference type.

TR

The type of redo parameters to pass. Must be a reference type.

Remarks

This method will do nothing if an undo or redo operation is executing.

| Edit this page View Source

Redo()

Function to perform a redo operation.

Declaration
Task Redo()
Returns
Type Description
Task

A task representing the currently executing redo operation.

| Edit this page View Source

Undo()

Function to perform an undo operation.

Declaration
Task Undo()
Returns
Type Description
Task

A task representing the currently executing undo operation.

Extension Methods

GorgonDebugExtensions.ValidateObject<T>(T, string)
GorgonNullExtensions.AsNullable<T>(object)
GorgonNullExtensions.IfNull<T>(object, T)
GorgonNullExtensions.IsNull(object)
  • Edit this page
  • View Source
In this article
Back to top Copyright 2023 - Licensed under the MIT license by Michael Winsor (Tape_Worm).
Send comments on this topic to the author