Hello everybody, is it possible to understand in which order the editing events are triggered on a group of edited Featureclasses \ Table ? In this example I have 4 featureclasses called A,B,C and Z.
To register the change events I used the following code (taking the layers in toc order).
protected override void OnClick()
{
QueuedTask.Run(() =>
{
//Listen for row events on a layer
IEnumerable<FeatureLayer> layers = MapView.Active.Map.GetLayersAsFlattenedList().Where(layer => layer is FeatureLayer).Select(x=>(FeatureLayer)x);
if (lst.Count == 0)
{
foreach (var fl in layers)
{
try
{
var fc = fl.GetFeatureClass();
//These events are fired once ~per feature~,
//per table
SubscriptionToken rowCreateToken = RowChangedEvent.Subscribe(OnRowChanged, fc);
lst.Add(rowCreateToken);
}
catch (Exception e)
{
}
}
}
else
{
lst.ForEach(x => RowChangedEvent.Unsubscribe(x));
lst.Clear();
}
//subscribe to row events
// var rowDeleteToken = RowDeletedEvent.Subscribe(OnRowDeleted, layerTable);
});
}
private Guid _currentRowChangedGuid = Guid.Empty;
private void OnRowChanged(RowChangedEventArgs args)
{
try
{
Debug.WriteLine(args.Row.GetTable().GetName().Split('.')[1]);
return;
}catch(Exception e){
return;
}
}
I take a group of features belonging to A,B,C and Z and move them (using the move tool). The return order of the modified features does not follow the registration, but it would appear to be a random order ( in this case Z,C,B,A). How is the return order of these events defined?
as all features have the same edit being applied (a "move") i suspect that it has more to do with the order in which the features are ordered in the selection set. So the first feature in the selection set is probably moved first, the second moved second, etc. I dont think the order in which u register for events has any bearing on the order in which u receive the events.
hi charles,
I did several tests and I don't think that the selection order affects the return order of the elements. In the tests I selected in the order: z,c,a,b and the answer order was: z,c,b,a. Another try with c,a,z,b -> z,c,b,a. I can not understand...
the order in the selection set is controlled by object id I believe and not the order in which features are selected.
I tried with objectid. The 4 Featureclasses have 5 objects in total
A -> objectid 104
B -> objectid 121
C -> objectid 103
Z -> objectid 61,200
When I move 104,121,103 and 61 the order is this : Z,C,B,A
The same with : 104,121,103 and 200
I'm even more confused 😞
Any other idea?