Search Results for

    Show / Hide Table of Contents

    Class UndoContext

    Gives access to a state based undo mechanism for ProjectObjects. Each Project has its own undo context. The undo context makes it possible to group changes to ProjectObjects. All changes in the group can then be undone and redone.

    Inheritance
    object
    UndoContext
    Namespace: ABB.Robotics.RobotStudio
    Assembly: ABB.Robotics.RobotStudio.dll
    Syntax
    public sealed class UndoContext

    Properties

    View Source

    CanRedo

    Returns true if there are entries in the Redo queue, otherwise false.

    Declaration
    public bool CanRedo { get; }
    Property Value
    Type Description
    bool
    View Source

    CanUndo

    Returns true if there are entries in the Undo queue, otherwise false.

    Declaration
    public bool CanUndo { get; }
    Property Value
    Type Description
    bool
    View Source

    CurrentUndoStepName

    Gets or sets the name of the current undo step

    Declaration
    public string CurrentUndoStepName { get; set; }
    Property Value
    Type Description
    string
    View Source

    IsAppending

    Returns true if the active undo step has been opened using AppendToUndoStep()

    Declaration
    public bool IsAppending { get; }
    Property Value
    Type Description
    bool
    View Source

    IsInUndoStep

    Returns true if the application is currently inside an undo step.

    Declaration
    public bool IsInUndoStep { get; }
    Property Value
    Type Description
    bool
    View Source

    NumRedoSteps

    Returns the number of available Redo steps

    Declaration
    public int NumRedoSteps { get; }
    Property Value
    Type Description
    int
    View Source

    NumUndoSteps

    Returns the number of available Undo steps

    Declaration
    public int NumUndoSteps { get; }
    Property Value
    Type Description
    int
    View Source

    QueueSize

    Gets or sets the maximum size for the Undo and Redo queues.

    Declaration
    public int QueueSize { get; set; }
    Property Value
    Type Description
    int

    Methods

    View Source

    AddChange(IChange)

    Adds an undoable operation (see IChange).

    Declaration
    public void AddChange(IChange change)
    Parameters
    Type Name Description
    IChange change
    Remarks

    If an undo step is not currently open, the change will be added to the previous undo step.

    View Source

    AppendToUndoStep(string)

    Similar to BeginUndoStep(string), but tries to append changes to the previous undo step, instead of creating a new one.

    Declaration
    public void AppendToUndoStep(string name)
    Parameters
    Type Name Description
    string name
    Remarks

    The name must match the name of the previous undo step. Otherwise a new undo step one will be created.

    View Source

    AppendToUndoStep(string, bool)

    Similar to BeginUndoStep(string), but tries to append changes to the previous undo step, instead of creating a new one.

    Declaration
    public void AppendToUndoStep(string name, bool forceAppend)
    Parameters
    Type Name Description
    string name

    Name of undo step, if a new one is created.

    bool forceAppend

    If true, changes are appended to the previous undostep (if one exists) even if the names do not match.

    View Source

    BeginUndoStep()

    Starts a new unnamed undo step.

    Declaration
    public void BeginUndoStep()
    Remarks

    It is not recommended to make unnamed undo steps. Use BeginUndoStep(string name) instead.

    View Source

    BeginUndoStep(string)

    Begins a new undo step.

    Declaration
    public void BeginUndoStep(string name)
    Parameters
    Type Name Description
    string name

    The name of the undo step.

    Remarks

    The name should be localized, since it will be displayed in the user interface.

    View Source

    CancelUndoStep(CancelUndoStepType)

    Marks the current undo step as canceled.

    Declaration
    public void CancelUndoStep(CancelUndoStepType cancelType)
    Parameters
    Type Name Description
    CancelUndoStepType cancelType
    Remarks

    When the canceled undo step is closed by EndUndoStep(), either all changes will be undone ("rollback"), or the undo/redo queues will be cleared, depending on the value of 'cancelType'.

    View Source

    Clear()

    Clears the Undo and Redo queues.

    Declaration
    public void Clear()
    View Source

    EndUndoStep()

    Ends the current undo step.

    Declaration
    public void EndUndoStep()
    Remarks

    It is legal to make nested calls to Begin/EndUndoStep(). Only the outermost EndUndoStep() call will actually close the undo step.

    View Source

    ExecuteAppendUndoStep(string, Action)

    Creates or appends to an undo step and executes the code in the passed in delegate inside it.

    Declaration
    public bool ExecuteAppendUndoStep(string undoStepName, Action action)
    Parameters
    Type Name Description
    string undoStepName
    Action action
    Returns
    Type Description
    bool

    True if the operation succeeded, false if an exception was thrown.

    Remarks

    The name must match the name of the previous undo step. Otherwise a new undo step one will be created. In case of an exception, the undo step will be rolled back and the error will be logged to the RobotStudio output window.

    View Source

    ExecuteUndoStep(string, Action)

    Creates an undo step and executes the code in the passed in delegate inside it.

    Declaration
    public bool ExecuteUndoStep(string undoStepName, Action action)
    Parameters
    Type Name Description
    string undoStepName
    Action action
    Returns
    Type Description
    bool

    True if the operation succeeded, false if an exception was thrown.

    Remarks

    In case of an exception, the undo step will be rolled back and the error will be logged to the RobotStudio output window.

    View Source

    ExecuteUndoStep(string, Action, Action<Exception>)

    Creates an undo step and executes the code in the passed in delegate inside it.

    Declaration
    public bool ExecuteUndoStep(string undoStepName, Action action, Action<Exception> errorHandler)
    Parameters
    Type Name Description
    string undoStepName
    Action action
    Action<Exception> errorHandler
    Returns
    Type Description
    bool

    True if the operation succeeded, false if an exception was thrown.

    Remarks

    In case of an exception, the passed in errorHandler delegate will be executed.

    View Source

    GetRedoNames()

    Returns an array of the names of all redo steps in the redo queue

    Declaration
    public string[] GetRedoNames()
    Returns
    Type Description
    string[]
    View Source

    GetUndoNames()

    Returns an array of the names of all undo steps in the undo queue

    Declaration
    public string[] GetUndoNames()
    Returns
    Type Description
    string[]
    View Source

    Redo()

    Redoes the changes undone by the last call to Undo()

    Declaration
    public void Redo()
    Remarks

    It is not legal to call this method while inside an undo step.

    View Source

    ResumeUndoStep()

    Resumes collection of undoable changes.

    Declaration
    public void ResumeUndoStep()
    View Source

    SuspendUndoStep()

    Temporarily disables collection of undoable changes.

    Declaration
    public void SuspendUndoStep()
    View Source

    Undo()

    Undoes the operations made during the last undo step.

    Declaration
    public void Undo()
    Remarks

    It is not legal to call this method while inside an undo step.

    Events

    View Source

    Redoing

    Occurs before a redo operation.

    Declaration
    public event EventHandler Redoing
    Event Type
    Type Description
    EventHandler
    View Source

    Redone

    Occurs after a redo operation.

    Declaration
    public event EventHandler Redone
    Event Type
    Type Description
    EventHandler
    View Source

    Undoing

    Occurs before an undo operation.

    Declaration
    public event EventHandler Undoing
    Event Type
    Type Description
    EventHandler
    View Source

    Undone

    Occurs after an undo operation.

    Declaration
    public event EventHandler Undone
    Event Type
    Type Description
    EventHandler
    • View Source
    In this article
    Back to top Copyright © 2026 ABB Robotics