Parameters
- category
- The category of operation of undo.
Return Value
A task that represents the work queued to execute in the ThreadPool.
| Exception | Description |
|---|---|
| System.Exception | Thrown when the operation's ArcGIS.Desktop.Framework.Contracts.Operation.CanUndo method returns false. |
| System.Exception | Thrown when the operation's ArcGIS.Desktop.Framework.Contracts.Operation.CanUndo method returns false. |
The most recent operation of a particular category in the stack is undone by calling its ArcGIS.Desktop.Framework.Contracts.Operation.UndoAsync method. The operation is then added to this OperationManager's redo stack.
// Executes an edit operation and demonstrates how to undo the operation programmatically. await QueuedTask.Run(() => { var editOp = new EditOperation { Name = "My Name" }; if (!editOp.IsEmpty) { //Execute and ExecuteAsync will return true if the operation was successful and false if not var result = editOp.Execute(); if (result == true) { // If the operation was successful, you can undo it editOp.UndoAsync(); } } });
// Demonstrates how to undo and redo the most recent operation using the map's operation manager. //undo if (activeMap.OperationManager.CanUndo) activeMap.OperationManager?.UndoAsync();//await as needed //redo if (MapView.Active.Map.OperationManager.CanRedo) activeMap.OperationManager?.RedoAsync();//await as needed }
Target Platforms: Windows 11 Home, Pro, Enterprise (64 bit)