如何使用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.