public partial class PageMap : PhoneApplicationPage
{
public PageMap()
{
InitializeComponent();
map1.Mode = new RoadMode();
GeoCoordinateWatcher gcw = new GeoCoordinateWatcher();
gcw.PositionChanged += new EventHandler<GeoPositionChangedEventArgs<GeoCoordinate>>(gcw_PositionChanged);
gcw.Start();
}
void gcw_PositionChanged(object sender, GeoPositionChangedEventArgs<GeoCoordinate> e)
{
map1.SetView(new GeoCoordinate(e.Position.Location.Latitude, e.Position.Location.Longitude), 15);
}
}
之前见到过用map1.SetView(new Location(e.Position.Location.Latitude,e.Posetion.Location.Longitude)),不过vs2010好像没有这样的用法,即使是引用了using System.Device.Location,但我觉得应该不是这个问题??。。 |