如何使用C#确定C#应用程序用户的地理位置 [英] How to Determine the geolocation of a c# app user with c#

查看:141
本文介绍了如何使用C#确定C#应用程序用户的地理位置的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

确定c#应用程序的用户地理位置

Determine a user geolocation of a c# app

推荐答案

您好,

.net中有一个程序集可以包装所有内容!它是.net 4和4.5的一部分,请参见此处:

http://msdn.microsoft.com/zh-CN /library/system.device.location(v=vs.100).aspx [ http://code.msdn.microsoft.com/windowsdesktop/Windows-7-Geolocation- API-25585fac [ ^ ]


只是几行代码:

Hello,

There is an assembly in .net that wraps all that! it is part of .net 4 and 4.5 see here:

http://msdn.microsoft.com/en-us/library/system.device.location(v=vs.100).aspx[^]

Here is a good sample:

http://code.msdn.microsoft.com/windowsdesktop/Windows-7-Geolocation-API-25585fac[^]


It''s just a few lines of code:

var watcher = new GeoCoordinateWatcher(); 
watcher.TryStart(false,TimeSpan.FromMilliseconds(5000)); 
var coord = watcher.Position.Location; 



您只需要确保已启用计算机传感器即可.

瓦莱里.



You just need to make sure your computer sensors are enabled.

Valery.


这篇关于如何使用C#确定C#应用程序用户的地理位置的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆