Event for when map service image is returned?

1979
4
11-11-2010 10:13 AM
BrentStevener
New Contributor II
I have noticed that sometimes it takes a while for my silverlight app to display the first map image of our dynamic map service. Other controls on the app will display, but the image is blank until it is retrieved, which sometimes leaves a good 5 seconds or so of people wondering why there is a blank map.

To help resolve this, I am wanting to display a Silverlight ChildWindow as a sort of "loading screen", and would like to have it show until a particular map service's image is returned for the first time. I can show it in the MainPage.Loaded event, but I don't see any events that occur when the map image is actually displayed in the control in order to close the window. I tried the Layer.Initialized event, but that still fires before the image is returned to the client (but it is as close as I have come to where I want it). Any ideas?
0 Kudos
4 Replies
JenniferNery
Esri Regular Contributor
You can make use of MapProgressBar from the Toolkit (http://help.arcgis.com/en/webapi/silverlight/2.1/samples/start.htm#MapProgressBar or simply subscribe to Map's Progress
0 Kudos
BrentStevener
New Contributor II
So if I handle the Map.Progress event, will the last event that fires always be when the Progress property of the ProgressEventArgs object is 100 (indicating the progress is complete)? So I just check when the progress is 100?
0 Kudos
BrentStevener
New Contributor II
It works beautifully, using the below code. Am I correct in assuming that it will return 100 every time when it is finished?
Private Sub MyMap_Progress(ByVal sender As Object, ByVal e As ESRI.ArcGIS.Client.ProgressEventArgs) Handles MyMap.Progress
        If e.Progress = 100 Then
            _LoadingWindow.Close()
        End If
End Sub
0 Kudos
JenniferNery
Esri Regular Contributor
Yes that is correct, the dynamic layer will return Progress of 100 when the image is returned.
0 Kudos