private void OnSaveFeatures(Editor.EditEventArgs e)
{
FeatureLayer fLayer = null;
foreach (Editor.Change c in e.Edits)
{
if (c.Layer.ID.ToUpper() == "ProjectPolys".ToUpper())
{
fLayer = c.Layer as FeatureLayer;
if (c.Graphic != null)
{
if (c.Graphic.Attributes.ContainsKey("Expiration_Date"))
{
if (c.Graphic.Attributes["Expiration_Date"] != null)
((FeatureLayer)c.Layer).Graphics.Remove(c.Graphic);
}
}
else
Debug.WriteLine("null graphic!");
}
}
if (fLayer != null)
fLayer.Update(); // this is a workaround
}
private void FeatureLayer_EndSaveEdits(object sender, EndEditEventArgs e)
{
if(e.Results== null|| e.Results.UpdateResults == null) return;
FeatureLayer layer = sender as FeatureLayer;
foreach (var item in e.Results.UpdateResults)
{
Graphic graphic = layer.Graphics.Where(g =>(int) g.Attributes[layer.LayerInfo.ObjectIdField] ==(int) item.ObjectID).First();
//TODO: your code goes here
}
}