I have coded a Customized Command (or button) in ArcMap by using the ArcObjects library in C#.
I would like to check if there is any ongoing editing session (and close it) when the user presses that button. Is there any way to do that?
Hi Marcelo,
try this:
public void StopEditing(bool saveChanges) { //Get a reference to the editor. UID uid = new UIDClass(); uid.Value = "esriEditor.Editor"; IEditor editor = m_application.FindExtensionByCLSID(uid)as IEditor; //Check to see if a workspace is already being edited. if (editor.EditState != esriEditState.esriStateNotEditing) { editor.StopEditing(saveChanges); } }
have a look at the editing-API: ArcObjects Help for .NET developers
Frank
Thank you Frank!
Just to add that I needed to add the reference ESRI.ArcGIS.Editor and to insert the line
using ESRI.ArcGIS.Editor;
Les membres connectés peuvent publier, suivre les mises à jour, et plus encore. Nouveau ici ? Inscrivez-vous gratuitement.
Find useful guides, FAQs, and documents to help you navigate and make the most of Esri Community.