Is there a way I can pass in my own parameters to QueryTask?I can have 2 or more QueryTask run asynchronously, and the completed event handler are invoked after each QueryTask is done. I want to pass in a parameter to recognize which QueryTask I'm running. Or is there a flag or property that I can detect?Thanks!
Yes, you will have access to UserToken in the Completed event. See post# 4 in this thread http://forums.arcgis.com/threads/19810-showing-related-records-in-maptips
Yes, this is possible with UserToken IDictionary<string, object> parameters = new Dictionary<string, object>(); parameters["param1"] = 1; parameters["param2"] = "one"; QueryTask qt = new QueryTask(); Query q = new Query(); qt.ExecuteCompleted += (s, e) => { var myParams = e.UserState as IDictionary; var param1 = (int)myParams["param1"]; var param2 = (string)myParams["param2"]; }; qt.ExecuteAsync(q, parameters);
IDictionary<string, object> parameters = new Dictionary<string, object>(); parameters["param1"] = 1; parameters["param2"] = "one"; QueryTask qt = new QueryTask(); Query q = new Query(); qt.ExecuteCompleted += (s, e) => { var myParams = e.UserState as IDictionary; var param1 = (int)myParams["param1"]; var param2 = (string)myParams["param2"]; }; qt.ExecuteAsync(q, parameters);
You can pass in a value for the userToken when you invoke ExecuteAsync. See the reference for details http://help.arcgis.com/en/webapi/silverlight/apiref/ESRI.ArcGIS.Client~ESRI.ArcGIS.Client.Tasks.QueryTask~ExecuteAsync(Query,Object).html
Signed in members can post, follow updates, and more. New here? Register a free account.
Find useful guides, FAQs, and documents to help you navigate and make the most of Esri Community.