91av视频/亚洲h视频/操亚洲美女/外国一级黄色毛片 - 国产三级三级三级三级

  • 大小: 2.78MB
    文件類型: .zip
    金幣: 2
    下載: 1 次
    發(fā)布日期: 2023-10-02
  • 語言: C#
  • 標簽:

資源簡介

內(nèi)含數(shù)據(jù)庫,GPS定位后進行地圖顯示,接收到數(shù)據(jù)后,可保存到數(shù)據(jù)庫中,數(shù)據(jù)庫的文件為GPS.mdf,GPS_log.ldf。外接GPS后通過串口進行數(shù)據(jù)解析,最終在地圖中顯示GPS的位置。

資源截圖

代碼片段和文件信息

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?System.IO.Ports;
using?System.Text.Regularexpressions;
//添加命名空間(數(shù)據(jù)庫)
using?System.Data.SqlClient;
//添加命名空間(地圖加載)
using?GMap.NET;
using?GMap.NET.MapProviders;

namespace?WindowsFormsApplication1
{
????public?partial?class?Main?:?Form
????{

????????//數(shù)據(jù)庫
????????//定義全局變量
????????//聲明SqlConnection對象
????????SqlConnection?sqlCon;
????????//聲明SqlDataAdapter對象
????????SqlDataAdapter?sda;
????????//聲明連接字符串
????????string?strCon;

????????public?Main()
????????{
????????????InitializeComponent();
????????}
????????List?buffer?=?new?List(4096);
????????private?SerialPort?sp1?=?new?SerialPort();???//聲明并實例化類

????????private?void?main_Load_1(object?sender?EventArgs?e)
????????{
????????????//加載Form1時,添加ComboBox的下拉框
????????????//向串口名稱下拉框里添加COM1-COM6
????????????串口號.Items.Add(“COM1“);
????????????串口號.Items.Add(“COM2“);
????????????串口號.Items.Add(“COM3“);
????????????串口號.Items.Add(“COM4“);
????????????串口號.SelectedIndex?=?0;
????????????//向波特率下拉框里添加波特率值
????????????波特率.Items.Add(“4800“);
????????????波特率.Items.Add(“9600“);
????????????波特率.Items.Add(“19200“);
????????????波特率.SelectedIndex?=?0;
????????????//向數(shù)據(jù)位下拉框里添加數(shù)據(jù)位578
????????????數(shù)據(jù)位.Items.Add(“8“);
????????????數(shù)據(jù)位.Items.Add(“7“);
????????????數(shù)據(jù)位.Items.Add(“5“);
????????????數(shù)據(jù)位.SelectedIndex?=?0;
????????????//向停止位下拉框里添加停止位11.52
????????????停止位.Items.Add(“1“);
????????????停止位.Items.Add(“1.5“);
????????????停止位.Items.Add(“2“);
????????????停止位.SelectedIndex?=?0;
????????????//向校驗位下拉框里添加檢錯方式,NONE,ODD,EVEN
????????????檢驗位.Items.Add(“NONE“);
????????????檢驗位.Items.Add(“ODD“);
????????????檢驗位.Items.Add(“EVEN“);
????????????檢驗位.SelectedIndex?=?0;

????????????//添加事件注冊
????????????sp1.DataReceived?+=?sp1_DataReceived;//自動接收數(shù)據(jù)?先在Form加載事件中添加代碼

????????}

????????void?sp1_DataReceived(object?sender?SerialDataReceivedEventArgs?e)
????????{
????????????int?n?=?sp1.BytesToRead;??//獲取接受緩沖區(qū)中數(shù)據(jù)的字節(jié)數(shù),先記錄下來,
????????????//避免某種原因,人為的原因,操作幾次之間時間長,緩存不一致
????????????byte[]?buf?=?new?byte[n];??//聲明一個臨時數(shù)組存儲當前來的串口數(shù)????
????????????int?length?=?sp1.Read(buf?0?n);?//讀取緩沖數(shù)據(jù)
????????????buffer.AddRange(buf);????//將指定集合的元素添加到以獲取字節(jié)的后面

????????????byte[]?receiveByte?=?new?byte[100];
????????????while?(buffer.Count?>?100)?????//獲取的數(shù)組元素大于100,進入循環(huán)
????????????{
????????????????for?(int?i?=?0;?i?????????????????{
????????????????????if?(buffer[i]?==?0x24)??//查找到$或0x24
????????????????????{
????????????????????????if?(buffer.Count?????????????????????????{
????????????????????????????break;
????????????????????????}
????????????????????????else
????????????????????????{
????????????????????????????for?(int?j?=?0;?j?????????????????????????????{
????????????????????????????????

?屬性????????????大小?????日期????時間???名稱
-----------?---------??----------?-----??----
?????目錄???????????0??2016-10-31?19:31??GPS\
?????目錄???????????0??2016-10-31?19:31??GPS\GPS\
?????目錄???????????0??2016-10-31?19:30??GPS\GPS\bin\
?????目錄???????????0??2016-10-31?19:31??GPS\GPS\bin\Debug\
?????文件?????2444288??2015-04-01?21:19??GPS\GPS\bin\Debug\GMap.NET.Core.dll
?????文件??????163565??2015-04-01?21:19??GPS\GPS\bin\Debug\GMap.NET.Core.xml
?????文件??????150016??2015-04-01?21:19??GPS\GPS\bin\Debug\GMap.NET.WindowsForms.dll
?????文件???????36576??2015-04-01?21:19??GPS\GPS\bin\Debug\GMap.NET.WindowsForms.xml
?????文件???????22528??2016-10-13?21:21??GPS\GPS\bin\Debug\GPS.exe
?????文件???????34304??2016-10-13?21:21??GPS\GPS\bin\Debug\GPS.pdb
?????文件???????11600??2016-10-13?21:47??GPS\GPS\bin\Debug\GPS.vshost.exe
?????文件?????????490??2010-03-17?22:39??GPS\GPS\bin\Debug\GPS.vshost.exe.manifest
?????文件???????17920??2015-12-07?21:27??GPS\GPS\bin\Debug\WindowsFormsApplication1.exe
?????文件???????24064??2015-12-07?21:27??GPS\GPS\bin\Debug\WindowsFormsApplication1.pdb
?????文件???????11600??2015-12-07?21:27??GPS\GPS\bin\Debug\WindowsFormsApplication1.vshost.exe
?????目錄???????????0??2015-12-07?22:39??GPS\GPS\bin\Release\
?????文件????????4043??2015-12-25?11:19??GPS\GPS\GPS.csproj
?????文件?????????143??2015-12-07?22:39??GPS\GPS\GPS.csproj.user
?????文件???????15672??2016-05-15?16:45??GPS\GPS\Main.cs
?????文件???????22659??2016-05-15?16:56??GPS\GPS\Main.Designer.cs
?????文件????????5817??2016-05-15?16:45??GPS\GPS\Main.resx
?????目錄???????????0??2016-02-05?01:05??GPS\GPS\obj\
?????目錄???????????0??2016-10-31?19:31??GPS\GPS\obj\x86\
?????目錄???????????0??2016-10-31?19:31??GPS\GPS\obj\x86\Debug\
?????文件???????30004??2016-03-13?13:50??GPS\GPS\obj\x86\Debug\DesignTimeResolveAssemblyReferences.cache
?????文件????????6475??2016-10-13?21:21??GPS\GPS\obj\x86\Debug\DesignTimeResolveAssemblyReferencesInput.cache
?????文件????????1514??2016-05-15?16:45??GPS\GPS\obj\x86\Debug\GenerateResource.read.1.tlog
?????文件????????5376??2016-05-15?16:45??GPS\GPS\obj\x86\Debug\GenerateResource.write.1.tlog
?????文件????????3954??2016-10-13?21:47??GPS\GPS\obj\x86\Debug\GPS.csproj.FileListAbsolute.txt
?????文件???????22528??2016-10-13?21:21??GPS\GPS\obj\x86\Debug\GPS.exe
?????文件???????34304??2016-10-13?21:21??GPS\GPS\obj\x86\Debug\GPS.pdb
............此處省略18個文件信息

評論

共有 條評論

相關(guān)資源