Select to view content in your preferred language

spatial query task on multi-layers sometimes skip some layers

784
1
01-20-2011 05:07 PM
DanDong
Deactivated User
Hi all,

My program is to do spatial query on eight layers. Since spatial query task is asynchronous call, so these eight layers are not called in order (like layer1, 2, 3....), but in disorder(layer3, 7, 2, 4....). I put a counter(returnedSpatialQueryCount) in the QueryTask_ExecuteCompleted to count the times
private void QueryTask_ExecuteCompleted(object sender, ESRI.ArcGIS.Client.Tasks.QueryEventArgs args)
        {
            returnedSpatialQueryCount += 1; // Add the variable by 1.
            MessageBox.Show("count= " + returnedSpatialQueryCount);
            MessageBox.Show("layerid= " + args.UserState.ToString());
        }


But I found sometimes, some layers are skipped. Giving an example, after messagebox showing "count=2" which means spatial query task is completed for two times, messagebox will show "count=5" or "count=8" or something like this, which results not all of the eight layers are executed spatial query task. I am guessing since spatial query is asynchronous process, maybe ExecuteAsync() is getting be called simultaneously for 2 or more layers?

Does anyone run into the same problem before? Any suggestions? Thank you!
0 Kudos
1 Reply
JenniferNery
Esri Regular Contributor
You may want to subscribe to QueryTask Failed event as well. It might be useful to run Fiddler with your app too.
0 Kudos