Select to view content in your preferred language

autorefresh map without clicking the button

623
1
07-16-2013 12:43 PM
JulieBiju
Deactivated User
Advance thanks to all.

I developed one ESRI silverlight web based application  for displaying the last position of vehicle on map. In my application one lastposition button available.When the client will click on this button one graphic will b added to the map which denoting the last position of vehicle.Now everything is working fine.
Now my requirement is , How to auto refresh this last position location on map in each 2 minute interval without cliking the button?

Please help me ASAP

here is my code

 Private Sub LnkLastPosition_Click(sender As Object, e As System.Windows.RoutedEventArgs) Handles LnkLastPosition.Click
                    LastPosition()    

    End Sub


Private Sub LastPositionFinalRunning(ByVal sender As Object, ByVal e As SelectLastPositionCompletedEventArgs)
 If e.Result.Count > 0 Then
            'Dim geometry1 As New Point(csys, rs("lon"), rs("lat"))
            .............
            Dim graphic As New Graphic() With
                {
                    .Geometry = New MapPoint(Convert.ToDouble(gpsNMEASentence(4)), Convert.ToDouble(gpsNMEASentence(2))),
                    .Symbol = TryCast(LayoutRoot.Resources(colourstyle), Symbol)
                }

            graphic.Attributes.Add("STRHOTSPOT", strhotspot)
            AddHandler graphic.MouseLeave, AddressOf Graphic_MouseLeave
            AddHandler graphic.MouseEnter, AddressOf Graphic_MouseEnter
            graphicsLayer.Graphics.Add(graphic)
          
            Dispatcher.BeginInvoke(Sub() ZoomToResolution(MyMap, 0.00000220549302222, New MapPoint(Convert.ToDouble(gpsNMEASentence(4)), Convert.ToDouble(gpsNMEASentence(2)))))
      
            MyMap.Visibility = Windows.Visibility.Visible
        End If
end sub
0 Kudos
1 Reply
vipulsoni
Regular Contributor
Your solution should be done by implementing .net timer class.

DispatcherTimer Class
http://msdn.microsoft.com/en-us/library/system.windows.threading.dispatchertimer(VS.95).aspx

Timer Class (for Non UI Interaction)
http://msdn.microsoft.com/en-us/library/system.threading.timer(v=VS.95).aspx
0 Kudos