我的问题是关于使用Bing地图随着Windows Phone 7这是什么,我需要做的更新Silverlight的Bing地图图钉的位置控制
- 调查服务每x秒检索汇总设置坐标
如果这是第一次将服务进行轮询
情节的这些坐标在地图上的自定义图钉(我用的图片和MapLayer)
PinObject pin = new PinObject() //Custom object { Id = groupMember.Id, PushPin = new Image() { Source = new System.Windows.Media.Imaging.BitmapImage(new Uri("blackpin.png", UriKind.Relative)), Opacity = 0.8, Stretch = System.Windows.Media.Stretch.None }, PinLocation = new GeoCoordinate(groupMember.Latitude, groupMember.Longitude) }; imageLayer.AddChild(pin.PushPin, pin.PinLocation); //Initialized in constructor pinObjects.Add(pin);// Add pin object to a list to provide a handle to the objects
自动设置地图缩放级别,使所有的绘制点是可见的(我假设使用LocationRect.CreateLocationRect应该做的)
var coords = pinObjects.Select(p => p.PinLocation).ToList(); myMap.SetView(LocationRect.CreateLocationRect(coords));
其他基于获得的新坐标,更新每个图钉在地图上的位置 PinObject pObj = pinObjects.FirstOrDefault(p => p.Id == groupMember.Id);
MapLayer.SetPosition(pObj.PushPin, new GeoCoordinate(groupMember.Latitude, groupMember.Longitude));
引脚加载fiine和调用服务,以获得他们的新位置加载罚款为好,问题是,他们在地图上的位置是永远不会更新,所以基本上他们只是坐在尽管所有这些工作都在后台进行,但我已经调试过,所以我知道它的工作原理。如何重置引脚的位置,如果使用图像不行,我可以使用图钉对象吗?这将如何工作?
在此先感谢。
我不能在你的代码中看到你确定你的位置变化是在UI层上执行的。 – bperreault 2012-04-05 00:19:26
对不起BPerreault,我不明白你的问题。 – 2012-04-05 10:58:55
嗨,所以我使用this.Dispatcher.BeginInvoke(()=> {});但它仍然不会更新地图上的图钉位置 – 2012-04-06 00:41:20