PDA开发系列:GPS模块的调用
生活随笔
收集整理的這篇文章主要介紹了
PDA开发系列:GPS模块的调用
小編覺得挺不錯的,現在分享給大家,幫大家做個參考.
摘要
???? 在wince6.0中,要調用GPS模塊,其實是一件很容易的事情。
正文??? 在wince6.0中,如果要調用GPS模塊,其實很簡單,微軟已經為我們做好了這一切,我們只需要在自己的解決方案中,添加對Microsoft.WindowsMobile.Samples.Location.dll的引用就可以了,然后獲取一個GPS的實例,如下:
static Gps _Gps = null;/// <summary>/// 獲取GPS設備/// </summary>public Gps GpsDevice{get{if (_Gps == null){lock (typeof(Gps)){if (_Gps == null){_Gps = new Gps();}}}return _Gps;}} 然后注冊LocationChanged的事件,打開GPS設備就可以了,如下: GpsDevice.LocationChanged += new LocationChangedEventHandler(GpsDevice_LocationChanged);void GpsDevice_LocationChanged(object sender, LocationChangedEventArgs args){try{if (PdaServer.PDAServer.IsRun && PdaServer.PDAServer.GpsDevice.Opened){//經度double Longitude = args.Position.Longitude;//緯度double Latitude = args.Position.Latitude;if (Longitude > 0 && Latitude > 0){//上傳GPS}}}catch { }}?
其他相關的屬性和方法見該dll。
相關下載:Microsoft.WindowsMobile.Samples.Location.rar
轉載于:https://www.cnblogs.com/HOH/archive/2010/11/08/1872033.html
總結
以上是生活随笔為你收集整理的PDA开发系列:GPS模块的调用的全部內容,希望文章能夠幫你解決所遇到的問題。
- 上一篇: 从PHP门外汉---菜鸟---高手的进阶
- 下一篇: 软件测试的艺术读书笔记