Select to view content in your preferred language

Remove All From Undo Stack

03-04-2020 11:00 AM
Occasional Contributor III

In my configuration I have a "Load Map" function that loads all of the Feature Services on the Map and Renders them for the user.  With the new Undo/Redo functionality for the Feature Service I am working on getting my users used to it.  However, when i load a map, add the Layers, and Render the Layers, the undo button becomes available to the user, even if I save edits and save project in the code.  I don't want the user to be able to undo my rendering and layer loading?  I want them to start off with no Redo or Undo available.  The OperationManager doesn'ts seem to have any entries in it?

//I don't know how to even find the categories available, but I want to remove all of them anyways and start with blank undo/redo stack
//Here is my initial attempt (Category??)

OperationManager _operationManager = new OperationManager();

List<Operation> ops = _operationManager.FindUndoOperations(o => o.Category == "Update Map Properties");

//Nother with != either
//So it must be empty?
ops = _operationManager.FindUndoOperations(o => o.Category != "Update Map Properties");

//This will fail/error as ops is empty
0 Kudos
2 Replies
Esri Regular Contributor


Most operations via the API are by design un-doable.  Same as via the UI.



0 Kudos
New Contributor III

Maybe using await Project.Current.SaveAsync(); to force save the project once everything is loaded and rendered the way you want would disable the Undo button so users can't backout the changes your code did.

0 Kudos