Can I call Project.Current.UndoEditAsync in the EditCompleted Event?

346
2
Jump to solution
03-06-2023 03:29 PM
DrewDowling
Occasional Contributor III

I have code that checks certain things in the EditCompleted event in a Pro extension. If certain conditions aren't met for certain edits I'd like to cancel the edit operation. Is it appropriate to call

Project.Current.UndoEditAsync();

inside the EditCompleted event?

 

I'm concerned that the edit that is just completing hasn't been added to the edit stack yet and I might actually undo a previous edit. Testing don't indicate this is a problem but I want to make sure.

 

0 Kudos
1 Solution

Accepted Solutions
CharlesMacleod
Esri Regular Contributor

this might help : ProConcepts-Editing#editcompletedevent . The edit has completed so u wont "skip" it if that is what u r wondering....

That said, if u do execute Project.Current.UndoEditAsync() within the event I would expect it to be re-entrant so be prepared to deal with that (and not end up in a continuous loop)

Refer to EditCompletedType on the event args

View solution in original post

2 Replies
CharlesMacleod
Esri Regular Contributor

this might help : ProConcepts-Editing#editcompletedevent . The edit has completed so u wont "skip" it if that is what u r wondering....

That said, if u do execute Project.Current.UndoEditAsync() within the event I would expect it to be re-entrant so be prepared to deal with that (and not end up in a continuous loop)

Refer to EditCompletedType on the event args

DrewDowling
Occasional Contributor III

Great. Thank you for the clarification and the advice.

0 Kudos