ActiveReports 19 .NET Edition
MESCIUS.ActiveReports.Design.Win Assembly / GrapeCity.ActiveReports.Design Namespace / UndoManager Class
Members Example

In This Topic
    UndoManager Class
    In This Topic
    The UndoManager class allows users to undo and redo changes.
    Object Model
    UndoManager Class
    Syntax
    'Declaration
     
    Public NotInheritable Class UndoManager 
    public sealed class UndoManager 
    Remarks

    The UndoManager class encapsulates the functionality required to manage a history of operations performed in the ActiveReports designer, allowing users to undo and redo actions. This class interacts with an underlying undo engine to track changes and manage the undo/redo stack.

    It provides methods to perform undo and redo operations, query the count of operations available for undo and redo, and retrieve descriptions of these operations for display in a user interface. The class also supports clearing the undo/redo history and raises events to notify subscribers when changes occur in the history.

    This class implements the System.IDisposable interface to properly release resources associated with the undo engine.

    Example
    // tbStandard_ButtonClick - calls ExecuteDesignerAction, or the associated function
    // based on the button clicked.
    
    private void tbStandard_ButtonClick(object sender, System.Windows.Forms.ToolBarButtonClickEventArgs e)
    {
        if((string)e.Button.Tag == "NewReport")  //New Report was Clicked
        {
            this.ardMain.NewReport();
            this.FillCombo();
        }
        if((string)e.Button.Tag == "Open")  //Open Report was Clicked
        {
            this.OpenReportFile();
        }
        if((string)e.Button.Tag == "Save")  //Save Report was Clicked
        {
            this.SaveReportFile();
        }
        if((string)e.Button.Tag == "SaveAs")  //SaveAs was Clicked
        {
            this.SaveAsReportFile();
        }
        if((string)e.Button.Tag == "ReportSettings")  //ReportSettings was Clicked
        {
            this.ardMain.ExecuteAction(DesignerAction.ReportSettings);
        }
        if((string)e.Button.Tag == "Undo")  //Undo was Clicked
        {
            this.ardMain.UndoManager.Undo();
        }
        if((string)e.Button.Tag == "Cut")  //Cut was Clicked
        {
            this.ardMain.ExecuteAction(DesignerAction.EditCut);
        }
        if((string)e.Button.Tag == "Copy")  //Copy was Clicked
        {
            this.ardMain.ExecuteAction(DesignerAction.EditCopy);
        }
        if((string)e.Button.Tag == "Paste")  //Paste was Clicked
        {
            this.ardMain.ExecuteAction(DesignerAction.EditPaste);
        }
        if((string)e.Button.Tag == "Delete")  //Delete was Clicked
        {
            this.ardMain.ExecuteAction(DesignerAction.EditDelete);
        }
        if((string)e.Button.Tag == "ReorderGroups")  //ReorderGroups was Clicked
        {
            this.ardMain.ExecuteAction(DesignerAction.ReorderGroups);
        }    
    }
    'tbStandard_ButtonClick - calls ExecuteDesignerAction, or the associated function
    'based on the button clicked.
    Private Sub tbStandard_ButtonClick(ByVal sender As Object, ByVal e As System.Windows.Forms.ToolBarButtonClickEventArgs) Handles tbStandard.ButtonClick
        If CStr(e.Button.Tag) = "NewReport" Then 'New Report was Clicked
            Me.ardMain.NewReport()
            Me.FillCombo()
        End If
        If CStr(e.Button.Tag) = "Open" Then 'Open Report was Clicked
            Me.OpenReportFile()
        End If
        If CStr(e.Button.Tag) = "Save" Then 'Save Report was Clicked
            Me.SaveReportFile()
        End If
        If CStr(e.Button.Tag) = "SaveAs" Then 'SaveAs was Clicked
            Me.SaveAsReportFile()
        End If
        If CStr(e.Button.Tag) = "ReportSettings" Then 'ReportSettings was Clicked
            Me.ardMain.ExecuteAction(DesignerAction.ReportSettings)
        End If
        If CStr(e.Button.Tag) = "Undo" Then 'Undo was Clicked
            Me.ardMain.UndoManager.Undo()
        End If
        If CStr(e.Button.Tag) = "Cut" Then 'Cut was Clicked
            Me.ardMain.ExecuteAction(DesignerAction.EditCut)
        End If
        If CStr(e.Button.Tag) = "Copy" Then 'Copy was Clicked
            Me.ardMain.ExecuteAction(DesignerAction.EditCopy)
        End If
        If CStr(e.Button.Tag) = "Paste" Then 'Paste was Clicked
            Me.ardMain.ExecuteAction(DesignerAction.EditPaste)
        End If
        If CStr(e.Button.Tag) = "Delete" Then 'Delete was Clicked
            Me.ardMain.ExecuteAction(DesignerAction.EditDelete)
        End If
        If CStr(e.Button.Tag) = "ReorderGroups" Then 'ReorderGroups was Clicked
            Me.ardMain.ExecuteAction(DesignerAction.ReorderGroups)
        End If
    End Sub 'tbStandard_ButtonClick
    Inheritance Hierarchy

    System.Object
       GrapeCity.ActiveReports.Design.UndoManager

    See Also