public LocationChangedEventArgs(GpsPosition position)
 {
     this.position = position;
 }
Пример #2
0
 public LocationChangedEventArgs(GpsPosition position)
 {
     this.position = position;
 }
Пример #3
0
 public GpsPosition GetPosition(TimeSpan maxAge)
 {
     GpsPosition gpsPosition = null;
     if (Opened) {
         IntPtr ptr = Utils.LocalAlloc (Marshal.SizeOf (typeof(GpsPosition)));
         gpsPosition = new GpsPosition ();
         gpsPosition.dwVersion = 1;
         gpsPosition.dwSize = Marshal.SizeOf (typeof(GpsPosition));
         Marshal.StructureToPtr (gpsPosition, ptr, false);
         int result = GPSGetPosition (gpsHandle, ptr, 500000, 0);
         if (result == 0) {
             gpsPosition = (GpsPosition)Marshal.PtrToStructure (ptr, typeof(GpsPosition));
             if (maxAge != TimeSpan.Zero) {
                 if (!gpsPosition.TimeValid || DateTime.Now -maxAge > gpsPosition.Time) {
                     gpsPosition = null;
                 }
             }
         }
         Utils.LocalFree (ptr);
     }
     return gpsPosition;
 }