How to create an edit operation for redo/undo using ArcObjects
IFeatureLayer fl;
IEditor editor;
IWorkspace ws;
ISelectionSet selSet;
fl = yourFeatureLayer;
editor = (IEditor)ArcMap.Application.FindExtensionByName("ESRI Object Editor");
ws = ((IDataset)fl).Workspace;
if (editor.EditState == esriEditState.esriStateNotEditing || editor.EditWorkspace != ws)
{
throw new ApplicationException("Start an edit session.");
}
// optionally, require selected features
selSet = ((IFeatureSelection)fl).SelectionSet;
if (selSet.Count == 0)
{
throw new ApplicationException("No features selected.");
}
try
{
editor.StartOperation();
// make edits here
// you'll see this edit under Edit => Undo/Redo
editor.StopOperation("Name of Edit Operation");
}
catch
{
editor.AbortOperation();
throw;
}