小编Dan*_*est的帖子

使用C#获取当前位置

我的技能水平:初学者

代码:C#(wpf)

硬件:戴尔Venue 11 Pro平板电脑(Windows 8.1)

我想通过坐标(纬度/经度)中的蜂窝三角测量来获取我的计算机的当前位置.使用以下链接作为参考(在Windows Phone 7上获取GPS坐标),我一直在尝试从Windows位置服务中提取纬度/经度坐标.我已经验证Windows位置服务是通过单元塔三角测量接收坐标,但每次运行以下代码时,坐标都会被列为"NaN".这里的任何帮助将不胜感激.

using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using System.Windows;
using System.Windows.Controls;
using System.Windows.Data;
using System.Windows.Documents;
using System.Windows.Input;
using System.Windows.Media;
using System.Windows.Media.Imaging;
using System.Windows.Navigation;
using System.Windows.Shapes;
using System.Device.Location;

namespace GPS
{
    /// <summary>
    /// Interaction logic for MainWindow.xaml
    /// </summary>
    public partial class MainWindow : Window
    {

        private GeoCoordinateWatcher watcher = new GeoCoordinateWatcher(GeoPositionAccuracy.Default);


        public MainWindow()
        {
            InitializeComponent();

            watcher.Start();

            LocationMessage(); 
        }



        private void LocationMessage()
        {

            var …
Run Code Online (Sandbox Code Playgroud)

c# wpf gps triangulation

5
推荐指数
1
解决办法
7230
查看次数

标签 统计

c# ×1

gps ×1

triangulation ×1

wpf ×1