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

相关文章:

  • 2021-10-24
  • 2021-09-11
  • 2021-07-22
  • 2021-05-26
  • 2021-12-17
  • 2022-01-21
  • 2021-07-26
猜你喜欢
  • 2022-02-20
  • 2021-09-08
  • 2022-03-06
  • 2022-03-02
  • 2021-10-27
  • 2021-12-27
  • 2021-06-13
相关资源
相似解决方案