I am in the process of upgrading my users to the newest version of ArcGIS Pro 2.4.3 and testing my code. It appears that CancelEdit is not performing as expecting in the OnRowChangeEvent? It seems to work in OnRowDeleteEvent but not in OnRowChange?
else if (ConditionTrue) //rollback
{
//CANCEL the Redraw Change
args.CancelEdit(() => ChangeError("Changes Not Allowed!", "Parent Shape Cannot be changed"));
}
I also put in simply args.CancelEdit() and that failed too
Solved! Go to Solution.
Thanks! its easily reproducible in 2.4 with the inspector.load example.
The good news is its not reproducible in 2.5 or 2.6 because of the way the editor now works with feature services and the undo stack.
As a workaround if you dont need the inspector to do anything fancy with the returned row, you can alternately read/write values using the row index as shown below:
private void onRowEvent(RowChangedEventArgs obj)
{
//var testLyr = MapView.Active.Map.FindLayers("FireHydrants").First() as FeatureLayer;
//var insp = new Inspector();
//insp.Load(testLyr, obj.Row.GetObjectID());
//get a row value
var op = obj.Row["Operable"];
//set the row value
obj.Row["Corroded"] = 1;
//cancel the edit
obj.CancelEdit();
}
Im submitting an issue as a potential fix for 2.4 if a future patch is planned.
can you think of any other work around where I can load the Inspector. I use the inspector in the row change to do a number of things and don't want to really change all my code if I don't have to? I load the inspector for this Row into an object that then has functions to ask and query information about the specific layer and related layers to the Row that is being edited and updated.
I cant think of a workaround using the inspector. You would have to look into the core.data (geodatabase) api to get the same information.
I was able to use the Row to detect if a CancelEdit had to be performed. Thank you for your help in this. Should I look into moving all of my inspector code to use Row instead? I build most of my program on the Inspector model, but maybe I should switch back to Row like we use to do with ArcObjects?
I would keep using the Inspector pattern outside of the row events as its just too convenient to use over the 'geodatabase' api within edit operations.
It seems that I can get this to work using the Rows. But I have noticed now that anytime I use Insperctor in the Row events at all, it begins to seriously slow down ArcGIS Pro. If you simply load an Inspector in the Row event, after a couple of times the system will start to degrade. Is there something that is not getting "Cleaned Up" or "Disposed" of in the Row event when you want to load an inspector from the Row that was sent in?
Hi M,
I'll try and replicate the issue, how are you measuring the performance degradation?