在 WM 平台上开发 GPS 导航系统
2010-02-21 22:52:00 来源:WEB开发网53 ' Do we have enough values to parse satellite-derived time?
54 If Words(1) <> "" Then
55 ' Yes. Extract hours, minutes, seconds and milliseconds
56 Dim UtcHours As Integer = CType(Words(1).Substring(0, 2), Integer)
57 Dim UtcMinutes As Integer = CType(Words(1).Substring(2, 2), Integer)
58 Dim UtcSeconds As Integer = CType(Words(1).Substring(4, 2), Integer)
59 Dim UtcMilliseconds As Integer
60 ' Extract milliseconds if it is available
61 If Words(1).Length > 7 Then UtcMilliseconds = _
62 CType(Single.Parse(Words(1).Substring(6), _
63 CultureInfo.InvariantCulture) * 1000, Integer)
64 ' Now build a DateTime object with all values
65 Dim Today As DateTime = System.DateTime.Now.ToUniversalTime
66 Dim SatelliteTime As New System.DateTime(Today.Year, Today.Month, _
67 Today.Day, UtcHours, UtcMinutes, UtcSeconds, UtcMilliseconds)
68 ' Notify of the new time, adjusted to the local time zone
69 RaiseEvent DateTimeChanged(SatelliteTime.ToLocalTime)
70 End If
71 ' Do we have enough information to extract the current speed?
72 If Words(7) <> "" Then
73 ' Yes. Convert it into MPH
74 Dim Speed As Double = CType(Words(7), Double) * 1.150779
75 ' If we're over 55MPH then trigger a speed alarm!
76 If Speed > 55 Then RaiseEvent SpeedLimitReached()
77 ' Notify of the new speed
78 RaiseEvent SpeedReceived(Speed)
79 End If
80 ' Do we have enough information to extract bearing?
81 If Words(8) <> "" Then
82 ' Indicate that the sentence was recognized
83 Dim Bearing As Double = CType(Words(8), Double)
84 RaiseEvent BearingReceived(Bearing)
85 End If
86 ' Does the device currently have a satellite fix?
- ››开发Android 日历教程
- ››开发学院总结 Win 8实用技巧大全
- ››开发学院原创教程:把win8的IE10放桌面上方法(非...
- ››开发者眼中的Windows Phone和Android
- ››开发学院教你用SQL 语句最快速清空MySQL 数据表的...
- ››WM 无法连接到win 7及webservice的异类原因
- ››开发一个自己的HTML在线编辑器(一)
- ››开发一个自己的HTML在线编辑器(二)
- ››开发者在App Store上赚的钱比在Android Market上多...
- ››开发者应深入学习的10个Android开源应用项目
- ››WM/WP上最完美的背光控制软件
- ››WM性能优化的一些经验
更多精彩
赞助商链接