AnsweredAssumed Answered

RowCreatedEvent or RowChangedEvent

Question asked by mjk5000 on Oct 30, 2017
Latest reply on Nov 2, 2017 by mjk5000

I want to catch all Row Created and Row Changed events.  When i catch them, to have edit events based on which class was being edited.  However, i can't figure out where to subscribe at.  When i do the following in the Configuration Manager, ArcGIS Pro constantly says "Drawing".  In ArcObjects, i did all this work in an "Editor" extension I made that caught all of the Creates, Changes, and Deletes.  I think this is what i need, but I can't figure out where to put the subRowEvent?

 

protected override void OnApplicationInitializing(CancelEventArgs cancelEventArgs)
{
var theme = FrameworkApplication.ApplicationTheme;
//ApplicationTheme enumeration
if (FrameworkApplication.ApplicationTheme != ApplicationTheme.Dark)
{
//Dark theme
FrameworkApplication.ApplicationTheme = ApplicationTheme.Dark;
}

subRowEvent();
}

protected void subRowEvent()
{
QueuedTask.Run(() =>
{
//Listen for row events on a layer
var featLayer = MapView.Active.GetSelectedLayers().First() as FeatureLayer;
var layerTable = featLayer.GetTable();

//subscribe to row events
var rowCreateToken = RowCreatedEvent.Subscribe(onRowEvent, layerTable);
var rowChangeToken = RowChangedEvent.Subscribe(onRowEvent, layerTable);
var rowDeleteToken = RowDeletedEvent.Subscribe(onRowEvent, layerTable);
});
}

protected void onRowEvent(RowChangedEventArgs args)
{
Console.WriteLine("RowChangedEvent " + args.EditType.ToString());
}

Outcomes