English 中文(简体)
我目前的立场
原标题:Simulate my current position

How to simulate my position in my app like GPS does? I want to do this from Additional Tools -> Location

供你的支持者使用的例子:

private void button2_Click(object sender, RoutedEventArgs e)
{
   BingMapsDirectionsTask bingMapsDirectionsTask = new BingMapsDirectionsTask();

   // You can specify a label and a geocoordinate for the end point.
   // GeoCoordinate spaceNeedleLocation = new GeoCoordinate(47.6204,-122.3493);
   // LabeledMapLocation spaceNeedleLML = new LabeledMapLocation("Space Needle", spaceNeedleLocation);

   // If you set the geocoordinate parameter to null, the label parameter is used as a search term.
   LabeledMapLocation spaceNeedleLML = new LabeledMapLocation("Space Needle", null);


   bingMapsDirectionsTask.End = spaceNeedleLML;

   // If bingMapsDirectionsTask.Start is not set, the user s current location is used as the start point.

   bingMapsDirectionsTask.Show();
}
最佳回答

您需要GeoCoordinationWatcher聆听全球定位系统位置。 后来,在取得第一种立场时,你先将“Thecode>LabeledMapLocation

例:

(第一,在您的项目参考资料中添加<代码>。

GeoCoordinateWatcher watcher;

// this receives the current GPS position (or the simulated one in the emulator)
private void HandleGeoPositionChanged(object sender, GeoPositionChangedEventArgs<GeoCoordinate> e)
{
    // we only need one coordinate - stop watching
    watcher.Stop();

    // initialize task and location
    BingMapsDirectionsTask bingMapsDirectionsTask = new BingMapsDirectionsTask();
    GeoCoordinate spaceNeedleLocation = new GeoCoordinate(e.Position.Location.Latitude, e.Position.Location.Longitude);
    LabeledMapLocation spaceNeedleLML = new LabeledMapLocation("Space Needle", spaceNeedleLocation);
    bingMapsDirectionsTask.End = spaceNeedleLML;

    // If bingMapsDirectionsTask.Start is not set, the user s current location is used as the start point.

    bingMapsDirectionsTask.Show();
}

// this starts watching for GPS coordinates, the Bing task will be invoked later
// when we receive our first coordinate
private void button1_Click(object sender, RoutedEventArgs e)
{
    // prepare for coordinate watching
    watcher = new GeoCoordinateWatcher(GeoPositionAccuracy.Default) { MovementThreshold = 10 };
    // register for position changes
    watcher.PositionChanged += HandleGeoPositionChanged;
    // start watching
    watcher.Start();
}

在主人中,你可以点击Bing地图,以改变你目前的立场。

页: 1 例如,当全球定位系统无法使用时,这项活动就告诉你。

问题回答

地理坐标 监视器是跟踪用户所在地的正确类别。 如果你想模拟用户为测试目的流动,你可以使用曼戈代尔的新地点跟踪特征。 这里的一条伟大条款:

http://www.jeffblankenburg.com/11/01/31-days-of-mango-day-1-the-new-windows-phone-emulator-tools/

如果你想要在运行时抽取用户的位置,你就只能创建地质坐标层的新例子,并提供你想要的纬度、长度、纬度等值。





相关问题
Anyone feel like passing it forward?

I m the only developer in my company, and am getting along well as an autodidact, but I know I m missing out on the education one gets from working with and having code reviewed by more senior devs. ...

NSArray s, Primitive types and Boxing Oh My!

I m pretty new to the Objective-C world and I have a long history with .net/C# so naturally I m inclined to use my C# wits. Now here s the question: I feel really inclined to create some type of ...

C# Marshal / Pinvoke CBitmap?

I cannot figure out how to marshal a C++ CBitmap to a C# Bitmap or Image class. My import looks like this: [DllImport(@"test.dll", CharSet = CharSet.Unicode)] public static extern IntPtr ...

How to Use Ghostscript DLL to convert PDF to PDF/A

How to user GhostScript DLL to convert PDF to PDF/A. I know I kind of have to call the exported function of gsdll32.dll whose name is gsapi_init_with_args, but how do i pass the right arguments? BTW, ...

Linqy no matchy

Maybe it s something I m doing wrong. I m just learning Linq because I m bored. And so far so good. I made a little program and it basically just outputs all matches (foreach) into a label control. ...

热门标签