Select to view content in your preferred language

Feature Layer Second Initialize/Update

855
3
Jump to solution
02-22-2012 03:54 AM
SelçukTınaz
Occasional Contributor
Hello Everyone,

   I am doing some geoprocessing works in my application. Then, i control many layer in deep if there is any graphic
in them that intersects with new graphic. There is no problem until here. Lets say i have 2 graphic those are in different
layers. So, i am trying to reshape them by order. I have ONE featurelayer. For the first one it is working, after first reshape
operation finished, i am clearing featurelayer ( = null // = new FeatureLayer) and then giving the the other featurelayer Url,
whereclause and other parameters. Problem goes right here. After giving parameters, i am trying to initialize or update
featurelayer (i am doing some operations inside completed events), but nothing happening.

I try many things but no solution.

Any help will be Perfect!

Thanks in Advance
0 Kudos
1 Solution

Accepted Solutions
SelçukTınaz
Occasional Contributor
Hi Everyone,

I guess i solve the problem. Firstly, I registered events like EditCompleted,UpdateCompleted,.....
But i was using lambda expression events. Because of this, When I set my featurelayer to new parameters
then, events are still in previous layer. So nothing happened, I changed my code a little bit each time ? register
events without using lambda exp. so problem solved i guess (not tested yet).

Thank a lot for all your answers.

View solution in original post

0 Kudos
3 Replies
HugoCardenas
Emerging Contributor
Have you raised the "UpdateFailed" event on the feature layer?
I discovered, the hard-way, one needs to raise the "UpdateFailed" event as well; the "UpdateCompleted" does not fire wihtout it.

FeatureLayer fl = MyMap.Layers["MyFeatureLayer"] as FeatureLayer;
fl.UpdateCompleted += MyFeatureLayer_UpdateCompleted;
fl.UpdateFailed += new EventHandler<TaskFailedEventArgs>(MyFeatureLayer_UpdateFailed);

private void MyFeatureLayer_UpdateFailed(object sender, EventArgs args)
{
    FeatureLayer fl = sender as FeatureLayer;
    // display any errors if any (optional).
}


Hope this helps...

Hugo.
0 Kudos
JenniferNery
Esri Regular Contributor
What are you using to reshape? The following SDK sample might help: http://help.arcgis.com/en/webapi/silverlight/samples/start.htm#Reshape. It could also be that Reshape failed. Initialize failed or Update is not called. It is best to run Fiddler with your application to see the last web request made and/or set breakpoints to see which code is not hit.
0 Kudos
SelçukTınaz
Occasional Contributor
Hi Everyone,

I guess i solve the problem. Firstly, I registered events like EditCompleted,UpdateCompleted,.....
But i was using lambda expression events. Because of this, When I set my featurelayer to new parameters
then, events are still in previous layer. So nothing happened, I changed my code a little bit each time ? register
events without using lambda exp. so problem solved i guess (not tested yet).

Thank a lot for all your answers.
0 Kudos