GpsInfoView/Form1.cs
(开头部分) 4KB这里只显示每个文件的开头 60 行。登录后可以解锁完整代码。
using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.Data;
using System.Drawing;
using System.Linq;
using System.Text;
using System.Windows.Forms;
using GpsInfoNS;
using System.IO.Ports;
namespace GpsInfoView
{
public partial class Form1 : Form
{
SerialPort serialPort;
GpsInfo gpsInfoObj;
System.Timers.Timer timer;
public Form1()
{
InitializeComponent();
Control.CheckForIllegalCrossThreadCalls = false;
serialPort = new SerialPort();
serialPort.DataReceived += new SerialDataReceivedEventHandler(serialPort_DataReceived);
cboPortName.Items.AddRange(SerialPort.GetPortNames());
gpsInfoObj = new GpsInfo();
timer = new System.Timers.Timer();
timer.Enabled = false;
timer.Interval = 50;
timer.Elapsed += new System.Timers.ElapsedEventHandler(timer_Elapsed);
}
void timer_Elapsed(object sender, System.Timers.ElapsedEventArgs e)
{
try
{
Gpgga gpgga = gpsInfoObj.GetGpgga();
lblUtcTime.Text = "UTC Time:" + gpgga._utcHour + ":" + gpgga._utcMinute + ":" + gpgga._utcSecond;
lblLat.Text = "Lat:" + gpgga._latitude + gpgga._latitudeDirection;
lblLon.Text = "Lon:" + gpgga._longitude + gpgga._longitudeDirection;
lblGpsQI.Text = "Gps Quality:" + gpgga._gpsQualityIndicator;
lblUsedSatellite.Text = "Used Satellite:" + gpgga._usedSatellites;
lblSeaLevel.Text = "Sea leavel:" + gpgga._seaLevel + gpgga._seaLevelUnit;
Gprmc gprmc = gpsInfoObj.GetGprmc();
lblDate.Text = "Date:" + gprmc._year + gprmc._month + gprmc._day;
lblSpeed.Text = "Speed(KM/H):" + gprmc._speed;
lblCog.Text = "Course of ground:" + gprmc._cog;
}
catch (Exception)
{
后面还有 93 行代码,解锁后查看完整代码
24 小时内免费解锁 3 个项目,之后 1 积分/个。 规则说明
AI 解读
登录后可用,每次 10 积分,解读结果公开显示在下面。
还没有人解读过这个文件。
