Skip to main content
Home Forums Silverlight Programming Programming with .NET - General Callback Function Trouble
3 replies. Latest Post by surrounded on September 4, 2008.
(0)
surrounded
Member
15 points
47 Posts
09-04-2008 10:24 AM |
I have a function called from Page() in Page.xaml.cs which contains a foreach loop.
The loop calls a web service and retrieves coordinate geometry from user specified polygons. This is done through a callback function.
MY PROBLEM:
The callback function successfully retrieves the coordinate geometry for the first polygon, however all subsequent loops through the callback function contain the same coordinate geometry. So if I loop through the callback function four times, only the geometry from polygon 1 is correctly accessed. The remaining three coordinate geometries are the same as the first geometry. If I run the callback on each polygon separately, the corresponding geometry is correctly returned for each polygon. NOTE: for my purposes, the program needs dynamic geometry retrieval.
Suggestions for solving this.......thanks.
Skyrunner
Contributor
2489 points
485 Posts
09-04-2008 10:30 AM |
Without some code it's hard to see your problem.
Can you post some please.
duefectu
Participant
786 points
238 Posts
09-04-2008 10:36 AM |
There are several possible problems, and I don't understand the problem.
Do you have problems with a xaml created polygons?
WCF provided polygons?
Code behind created polygons?
Maybe a Thread problem?
Can you explain a litle more?
09-04-2008 10:57 AM |
From Page() in Page.xaml.cs, I call a web service to tell me the geometry type of a shapefile (ESRI format). The geometry type is returned as a string. Then I make a call to another web service to return coordinate geometry. To get the coordinate geometry from the shapefile, I use FDO (Feature Data Object - OSGeo). The coordinates are returned to the calling program in string[] format. The geometries (polygons) are added to a virtual earth map.
pCoords (returned coordinate geometry) in CompletePoly always contains the first geometry.
CODE BELOW:
{
map.Layers.Add(shapeLayer);
}
shapeLayer = getShapelayer(s.mapID);
asmx.SHP_LayerGeometryTypeCompleted +=
asmx.SHP_LayerGeometryTypeAsync((
//***************THIS RETURNS THE GEOMETRY TYPE AS A STRING
//************THIS MAKES ANOTHER CALL TO ANOTHER WEB SERVICE TO GET COORDINATE GEOMETRY
DrawShape(geometryType);
//***********GET COORDINATE GEOMETRY
asmx.SHP_ReturnGeometryCompleted +=
shapeLayer.List.Add(polygon);