开发者

Best way to update Locations dynamically in Bing Maps using Silverlight?

开发者 https://www.devze.com 2023-03-16 07:43 出处:网络
I\'m developing a test application in which I need to: a) Draw some paths from downloaded data. I have a REST/JSON server whith these data and my little app can consume it without any problem. The pa

I'm developing a test application in which I need to:

a) Draw some paths from downloaded data. I have a REST/JSON server whith these data and my little app can consume it without any problem. The paths are downloaded once and that's all.

b) Draw pushpins, circles, whatever at some locations BUT their locations can change in real-time. The Silverlight app must ask the REST server for updates in these points in order to update the shapes in the map. The REST provides the "last know position" by default, so this location is what I want to display dynamically.

My question is: which is the simplest way to achieve b)? I'm quite a rookie at Silverlight, so I don´t know 开发者_如何学Pythonif it has some 'automatic-obvious' way to do this automatic update. Do I need some 'timer' to consume the service, a local list of locations and bindings between shapes and these locations?

Thank you in advance!


I would say you're on the right track.

I would create an ObservableCollection of a data model that represents the locations, and bind that to the Bing MapControl. Then create a DataTemplate (probably based on PushPin) that will visually represent how you want the data point to look on the map. The paths can be created with MapPolyLines

Since you're communicating with a REST server, I think your best option for updating the points to have a Timer object like you mentioned, and perform a call to update the ObservableCollection every time that fires.

Hope this helps!

0

精彩评论

暂无评论...
验证码 换一张
取 消