In ArcPro 2.1 there was an Operation object available in the args:
private void OnRowChanged(ArcGIS.Desktop.Editing.Events.RowChangedEventArgs args)
{
QueuedTask.Run(() =>
{
EditOperation eo = args.Operation;
//blah blah blah
//more awesome code
//blah blah blah
});
}
I don't see it any longer in ArcPro 2.2 - anyone know if this is coming back?
Solved! Go to Solution.
Hi Jeff,
It wasn't publicly exposed in 2.1 but were looking to put it in for a future release, so we can all write more awesome code.
I feel like we've had this conversation before
Any idea *when* this will be available? Also how about Undo/Redo events?
Thanks,
Jeff
Hi Jeff,
It was pushed back to 2.3
Following up to this, it appears that the RowChangedEventArgs have a Guid property. Is it possible to obtain a reference to the underlying Edit Operation via the Guid property?
Nope. Although it is the GUID of the calling editoperation, there's no way to hydrate it.
The GUID is used here to prevent reentrancy scenarios.
Guid _lastEdit = Guid.Empty;
private void onRowChangedEvent(RowChangedEventArgs obj)
{
if (_lastEdit != obj.Guid)
{
obj.CancelEdit("Change Event\nAllow Edit?", true);
_lastEdit = obj.Guid;
}
}
Hello Sean,
I was super excited to see that 2.3 is out in the hopes that this would be addressed. But unfortunately it appears that this functionality was not included in 2.3. Do you have any further word on this functionality? My intended use is pretty much identical to the original question:
eventToken = ArcGIS.Desktop.Editing.Events.RowCreatedEvent.Subscribe(pointPlaced, addressFeatureClass);
private void pointPlaced(ArcGIS.Desktop.Editing.Events.RowChangedEventArgs args)
{
QueuedTask.Run(() =>
{
EditOperation op = args.Operation; // waiting for v2.3 to implement
// do awesome stuff to newly created address point
}
}
Hi Stuart,
2.4... for real this time.
I've been testing it this afternoon.
Cool. Thanks Sean for all of your hard work. Much appreciated.
Hello Sean,
I've had a chance to play around with the newly added .Operation property. There is one thing that I noticed that I wanted to ask you about though. Whenever I execute the edit operation that is passed to the event handler by the RowChangedEventArgs, it throws a System.NotSupportedException. If I catch the exception, and just do nothing with it, the edit operation will sucessfully complete. In the following code sample, It will sucessfully write "TEST WRITE" to "TESTFIELD", and show the error message in a dialog box.
void CreateHandler(RowChangedEventArgs args)
{
QueuedTask.Run(async () =>
{
Debug.WriteLine("Create Feature Event Handler");
try
{
EditOperation op = args.Operation;
op.Modify(args.Row, "TESTFIELD", "TEST WRITE");
await op.ExecuteAsync();
}
catch (NotSupportedException ex)
{
ArcGIS.Desktop.Framework.Dialogs.MessageBox.Show(ex.ToString(), "Not supported Exception:");
}
catch (Exception ex)
{
ArcGIS.Desktop.Framework.Dialogs.MessageBox.Show(ex.ToString(), "Exception:");
}
});
}
and the subsequent error dialog:
If I simply comment out the message box, the edit completes seamlessly from the user's perspective, but Visual Studio will push: "Exception thrown: 'System.NotSupportedException' in mscorlib.dll" to the debug console. Any thoughts on what is causing this?