├── 震动监测系统 ├── 震动监测系统DataSet.xsc ├── 震动监测系统DataSet.xss ├── Form1.cs ├── CTMySql.cs ├── DrawWave.cs ├── FormWave.cs ├── FormSignIn.cs ├── Form_SP_Set.cs ├── CTSerialPort.cs ├── Form_SP_Test.cs ├── controlconfig.cs ├── bin │ └── Debug │ │ └── icon │ │ ├── 数据库.png │ │ ├── 波形.png │ │ ├── 用户.png │ │ ├── 通信.png │ │ ├── 首页.png │ │ ├── 波形(1).png │ │ ├── 用户(1).png │ │ ├── 通信(1).png │ │ ├── 首页(1).png │ │ └── 数据库(1).png ├── packages.config ├── App.config ├── Program.cs ├── Properties │ ├── Settings.settings │ ├── AssemblyInfo.cs │ ├── Settings.Designer.cs │ ├── Resources.Designer.cs │ └── Resources.resx ├── 震动监测系统DataSet.xsd ├── FormSaveWaiting.Designer.cs ├── FormSaveWaiting.cs ├── FormSaveWaiting.resx ├── FormUserManage.resx ├── Form_SP_Set.resx ├── Form_SP_Test.resx ├── FormSignIn.resx ├── FormWave.resx ├── FormSignIn.Designer.cs ├── FormHistoryData.resx ├── Form_SP_Test.Designer.cs ├── Form_SP_Set.Designer.cs ├── FormHistoryData.cs └── 震动监测系统.csproj ├── icon ├── 波形.png ├── 用户.png ├── 通信.png ├── 数据库.png ├── 白色 │ ├── 波形白色.png │ ├── 用户白色.png │ ├── 通信白色.png │ ├── 首页白色.png │ └── 数据库白色.png ├── 首页20190611.png ├── 数据库.svg ├── 波形.svg ├── 用户.svg └── 通信.svg ├── 数据模拟发送 ├── App.config ├── Properties │ ├── Settings.settings │ ├── AssemblyInfo.cs │ ├── Settings.Designer.cs │ ├── Resources.Designer.cs │ └── Resources.resx ├── Program.cs ├── controlconfig.cs ├── 数据模拟发送.csproj ├── CTSerialPort.cs ├── Form1.resx └── Form1.cs ├── ConsoleApp1 ├── ConsoleApp1.csproj └── Program.cs ├── WindowsFormsControlLibrary1 ├── Properties │ ├── AssemblyInfo.cs │ ├── Resources.Designer.cs │ └── Resources.resx ├── WindowsFormsControlLibrary1.csproj ├── MyButton.Designer.cs ├── MyButton.cs └── MyButton.resx ├── README.md ├── 震动监测系统.sln ├── .gitattributes └── .gitignore /震动监测系统/震动监测系统DataSet.xsc: -------------------------------------------------------------------------------- 1 | -------------------------------------------------------------------------------- /震动监测系统/震动监测系统DataSet.xss: -------------------------------------------------------------------------------- 1 | -------------------------------------------------------------------------------- /icon/波形.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/ElecTroMagicX/Vibration-monitoring/HEAD/icon/波形.png -------------------------------------------------------------------------------- /icon/用户.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/ElecTroMagicX/Vibration-monitoring/HEAD/icon/用户.png -------------------------------------------------------------------------------- /icon/通信.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/ElecTroMagicX/Vibration-monitoring/HEAD/icon/通信.png -------------------------------------------------------------------------------- /icon/数据库.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/ElecTroMagicX/Vibration-monitoring/HEAD/icon/数据库.png -------------------------------------------------------------------------------- /icon/白色/波形白色.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/ElecTroMagicX/Vibration-monitoring/HEAD/icon/白色/波形白色.png -------------------------------------------------------------------------------- /icon/白色/用户白色.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/ElecTroMagicX/Vibration-monitoring/HEAD/icon/白色/用户白色.png -------------------------------------------------------------------------------- /icon/白色/通信白色.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/ElecTroMagicX/Vibration-monitoring/HEAD/icon/白色/通信白色.png -------------------------------------------------------------------------------- /icon/白色/首页白色.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/ElecTroMagicX/Vibration-monitoring/HEAD/icon/白色/首页白色.png -------------------------------------------------------------------------------- /震动监测系统/Form1.cs: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/ElecTroMagicX/Vibration-monitoring/HEAD/震动监测系统/Form1.cs -------------------------------------------------------------------------------- /icon/白色/数据库白色.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/ElecTroMagicX/Vibration-monitoring/HEAD/icon/白色/数据库白色.png -------------------------------------------------------------------------------- /icon/首页20190611.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/ElecTroMagicX/Vibration-monitoring/HEAD/icon/首页20190611.png -------------------------------------------------------------------------------- /震动监测系统/CTMySql.cs: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/ElecTroMagicX/Vibration-monitoring/HEAD/震动监测系统/CTMySql.cs -------------------------------------------------------------------------------- /震动监测系统/DrawWave.cs: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/ElecTroMagicX/Vibration-monitoring/HEAD/震动监测系统/DrawWave.cs -------------------------------------------------------------------------------- /震动监测系统/FormWave.cs: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/ElecTroMagicX/Vibration-monitoring/HEAD/震动监测系统/FormWave.cs -------------------------------------------------------------------------------- /震动监测系统/FormSignIn.cs: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/ElecTroMagicX/Vibration-monitoring/HEAD/震动监测系统/FormSignIn.cs -------------------------------------------------------------------------------- /震动监测系统/Form_SP_Set.cs: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/ElecTroMagicX/Vibration-monitoring/HEAD/震动监测系统/Form_SP_Set.cs -------------------------------------------------------------------------------- /震动监测系统/CTSerialPort.cs: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/ElecTroMagicX/Vibration-monitoring/HEAD/震动监测系统/CTSerialPort.cs -------------------------------------------------------------------------------- /震动监测系统/Form_SP_Test.cs: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/ElecTroMagicX/Vibration-monitoring/HEAD/震动监测系统/Form_SP_Test.cs -------------------------------------------------------------------------------- /震动监测系统/controlconfig.cs: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/ElecTroMagicX/Vibration-monitoring/HEAD/震动监测系统/controlconfig.cs -------------------------------------------------------------------------------- /震动监测系统/bin/Debug/icon/数据库.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/ElecTroMagicX/Vibration-monitoring/HEAD/震动监测系统/bin/Debug/icon/数据库.png -------------------------------------------------------------------------------- /震动监测系统/bin/Debug/icon/波形.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/ElecTroMagicX/Vibration-monitoring/HEAD/震动监测系统/bin/Debug/icon/波形.png -------------------------------------------------------------------------------- /震动监测系统/bin/Debug/icon/用户.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/ElecTroMagicX/Vibration-monitoring/HEAD/震动监测系统/bin/Debug/icon/用户.png -------------------------------------------------------------------------------- /震动监测系统/bin/Debug/icon/通信.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/ElecTroMagicX/Vibration-monitoring/HEAD/震动监测系统/bin/Debug/icon/通信.png -------------------------------------------------------------------------------- /震动监测系统/bin/Debug/icon/首页.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/ElecTroMagicX/Vibration-monitoring/HEAD/震动监测系统/bin/Debug/icon/首页.png -------------------------------------------------------------------------------- /震动监测系统/bin/Debug/icon/波形(1).png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/ElecTroMagicX/Vibration-monitoring/HEAD/震动监测系统/bin/Debug/icon/波形(1).png -------------------------------------------------------------------------------- /震动监测系统/bin/Debug/icon/用户(1).png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/ElecTroMagicX/Vibration-monitoring/HEAD/震动监测系统/bin/Debug/icon/用户(1).png -------------------------------------------------------------------------------- /震动监测系统/bin/Debug/icon/通信(1).png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/ElecTroMagicX/Vibration-monitoring/HEAD/震动监测系统/bin/Debug/icon/通信(1).png -------------------------------------------------------------------------------- /震动监测系统/bin/Debug/icon/首页(1).png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/ElecTroMagicX/Vibration-monitoring/HEAD/震动监测系统/bin/Debug/icon/首页(1).png -------------------------------------------------------------------------------- /震动监测系统/bin/Debug/icon/数据库(1).png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/ElecTroMagicX/Vibration-monitoring/HEAD/震动监测系统/bin/Debug/icon/数据库(1).png -------------------------------------------------------------------------------- /数据模拟发送/App.config: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | -------------------------------------------------------------------------------- /ConsoleApp1/ConsoleApp1.csproj: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | Exe 5 | netcoreapp3.1 6 | 7 | 8 | 9 | -------------------------------------------------------------------------------- /数据模拟发送/Properties/Settings.settings: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | -------------------------------------------------------------------------------- /震动监测系统/packages.config: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | -------------------------------------------------------------------------------- /震动监测系统/App.config: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 9 | 10 | 11 | 12 | 13 | -------------------------------------------------------------------------------- /数据模拟发送/Program.cs: -------------------------------------------------------------------------------- 1 | using System; 2 | using System.Collections.Generic; 3 | using System.Linq; 4 | using System.Threading.Tasks; 5 | using System.Windows.Forms; 6 | 7 | namespace 数据模拟发送 8 | { 9 | static class Program 10 | { 11 | /// 12 | /// 应用程序的主入口点。 13 | /// 14 | [STAThread] 15 | static void Main() 16 | { 17 | Application.EnableVisualStyles(); 18 | Application.SetCompatibleTextRenderingDefault(false); 19 | Application.Run(new MainForm()); 20 | } 21 | } 22 | } 23 | -------------------------------------------------------------------------------- /震动监测系统/Program.cs: -------------------------------------------------------------------------------- 1 | using System; 2 | using System.Collections.Generic; 3 | using System.Linq; 4 | using System.Threading.Tasks; 5 | using System.Windows.Forms; 6 | using System.IO.Ports; 7 | 8 | namespace 震动监测系统 9 | { 10 | static class Program 11 | { 12 | /// 13 | /// 应用程序的主入口点。 14 | /// 15 | [STAThread] 16 | static void Main() 17 | { 18 | Application.EnableVisualStyles(); 19 | Application.SetCompatibleTextRenderingDefault(false); 20 | Application.Run(new FormSignIn()); 21 | } 22 | } 23 | } 24 | -------------------------------------------------------------------------------- /icon/数据库.svg: -------------------------------------------------------------------------------- 1 | 6 | -------------------------------------------------------------------------------- /icon/波形.svg: -------------------------------------------------------------------------------- 1 | -------------------------------------------------------------------------------- /icon/用户.svg: -------------------------------------------------------------------------------- 1 | -------------------------------------------------------------------------------- /震动监测系统/Properties/Settings.settings: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | <?xml version="1.0" encoding="utf-16"?> 7 | <SerializableConnectionString xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns:xsd="http://www.w3.org/2001/XMLSchema"> 8 | <ConnectionString>server=localhost;user id=root;persistsecurityinfo=True;database=震动监测系统</ConnectionString> 9 | <ProviderName>MySql.Data.MySqlClient</ProviderName> 10 | </SerializableConnectionString> 11 | server=localhost;user id=root;persistsecurityinfo=True;database=震动监测系统 12 | 13 | 14 | -------------------------------------------------------------------------------- /数据模拟发送/Properties/AssemblyInfo.cs: -------------------------------------------------------------------------------- 1 | using System.Reflection; 2 | using System.Runtime.CompilerServices; 3 | using System.Runtime.InteropServices; 4 | 5 | // 有关程序集的一般信息由以下 6 | // 控制。更改这些特性值可修改 7 | // 与程序集关联的信息。 8 | [assembly: AssemblyTitle("数据模拟发送")] 9 | [assembly: AssemblyDescription("")] 10 | [assembly: AssemblyConfiguration("")] 11 | [assembly: AssemblyCompany("")] 12 | [assembly: AssemblyProduct("数据模拟发送")] 13 | [assembly: AssemblyCopyright("Copyright © 2020")] 14 | [assembly: AssemblyTrademark("")] 15 | [assembly: AssemblyCulture("")] 16 | 17 | // 将 ComVisible 设置为 false 会使此程序集中的类型 18 | //对 COM 组件不可见。如果需要从 COM 访问此程序集中的类型 19 | //请将此类型的 ComVisible 特性设置为 true。 20 | [assembly: ComVisible(false)] 21 | 22 | // 如果此项目向 COM 公开,则下列 GUID 用于类型库的 ID 23 | [assembly: Guid("43e32eb0-0ac5-43af-8fab-e1b6578e534c")] 24 | 25 | // 程序集的版本信息由下列四个值组成: 26 | // 27 | // 主版本 28 | // 次版本 29 | // 生成号 30 | // 修订号 31 | // 32 | //可以指定所有这些值,也可以使用“生成号”和“修订号”的默认值 33 | //通过使用 "*",如下所示: 34 | // [assembly: AssemblyVersion("1.0.*")] 35 | [assembly: AssemblyVersion("1.0.0.0")] 36 | [assembly: AssemblyFileVersion("1.0.0.0")] 37 | -------------------------------------------------------------------------------- /震动监测系统/Properties/AssemblyInfo.cs: -------------------------------------------------------------------------------- 1 | using System.Reflection; 2 | using System.Runtime.CompilerServices; 3 | using System.Runtime.InteropServices; 4 | 5 | // 有关程序集的一般信息由以下 6 | // 控制。更改这些特性值可修改 7 | // 与程序集关联的信息。 8 | [assembly: AssemblyTitle("震动监测系统")] 9 | [assembly: AssemblyDescription("")] 10 | [assembly: AssemblyConfiguration("")] 11 | [assembly: AssemblyCompany("")] 12 | [assembly: AssemblyProduct("震动监测系统")] 13 | [assembly: AssemblyCopyright("Copyright © 2020")] 14 | [assembly: AssemblyTrademark("")] 15 | [assembly: AssemblyCulture("")] 16 | 17 | // 将 ComVisible 设置为 false 会使此程序集中的类型 18 | //对 COM 组件不可见。如果需要从 COM 访问此程序集中的类型 19 | //请将此类型的 ComVisible 特性设置为 true。 20 | [assembly: ComVisible(false)] 21 | 22 | // 如果此项目向 COM 公开,则下列 GUID 用于类型库的 ID 23 | [assembly: Guid("1e56599a-81ff-4a57-9d89-ba12bc0911f4")] 24 | 25 | // 程序集的版本信息由下列四个值组成: 26 | // 27 | // 主版本 28 | // 次版本 29 | // 生成号 30 | // 修订号 31 | // 32 | //可以指定所有这些值,也可以使用“生成号”和“修订号”的默认值 33 | //通过使用 "*",如下所示: 34 | // [assembly: AssemblyVersion("1.0.*")] 35 | [assembly: AssemblyVersion("1.0.0.0")] 36 | [assembly: AssemblyFileVersion("1.0.0.0")] 37 | -------------------------------------------------------------------------------- /WindowsFormsControlLibrary1/Properties/AssemblyInfo.cs: -------------------------------------------------------------------------------- 1 | using System.Reflection; 2 | using System.Runtime.CompilerServices; 3 | using System.Runtime.InteropServices; 4 | 5 | // 有关程序集的一般信息由以下 6 | // 控制。更改这些特性值可修改 7 | // 与程序集关联的信息。 8 | [assembly: AssemblyTitle("WindowsFormsControlLibrary1")] 9 | [assembly: AssemblyDescription("")] 10 | [assembly: AssemblyConfiguration("")] 11 | [assembly: AssemblyCompany("")] 12 | [assembly: AssemblyProduct("WindowsFormsControlLibrary1")] 13 | [assembly: AssemblyCopyright("Copyright © 2020")] 14 | [assembly: AssemblyTrademark("")] 15 | [assembly: AssemblyCulture("")] 16 | 17 | // 将 ComVisible 设置为 false 会使此程序集中的类型 18 | //对 COM 组件不可见。如果需要从 COM 访问此程序集中的类型 19 | //请将此类型的 ComVisible 特性设置为 true。 20 | [assembly: ComVisible(false)] 21 | 22 | // 如果此项目向 COM 公开,则下列 GUID 用于类型库的 ID 23 | [assembly: Guid("fb55f73e-451c-4012-b90e-a6af9ba7e22e")] 24 | 25 | // 程序集的版本信息由下列四个值组成: 26 | // 27 | // 主版本 28 | // 次版本 29 | // 生成号 30 | // 修订号 31 | // 32 | //可以指定所有这些值,也可以使用“生成号”和“修订号”的默认值 33 | //通过使用 "*",如下所示: 34 | // [assembly: AssemblyVersion("1.0.*")] 35 | [assembly: AssemblyVersion("1.0.0.0")] 36 | [assembly: AssemblyFileVersion("1.0.0.0")] 37 | -------------------------------------------------------------------------------- /数据模拟发送/Properties/Settings.Designer.cs: -------------------------------------------------------------------------------- 1 | //------------------------------------------------------------------------------ 2 | // 3 | // This code was generated by a tool. 4 | // Runtime Version:4.0.30319.42000 5 | // 6 | // Changes to this file may cause incorrect behavior and will be lost if 7 | // the code is regenerated. 8 | // 9 | //------------------------------------------------------------------------------ 10 | 11 | namespace 数据模拟发送.Properties 12 | { 13 | 14 | 15 | [global::System.Runtime.CompilerServices.CompilerGeneratedAttribute()] 16 | [global::System.CodeDom.Compiler.GeneratedCodeAttribute("Microsoft.VisualStudio.Editors.SettingsDesigner.SettingsSingleFileGenerator", "11.0.0.0")] 17 | internal sealed partial class Settings : global::System.Configuration.ApplicationSettingsBase 18 | { 19 | 20 | private static Settings defaultInstance = ((Settings)(global::System.Configuration.ApplicationSettingsBase.Synchronized(new Settings()))); 21 | 22 | public static Settings Default 23 | { 24 | get 25 | { 26 | return defaultInstance; 27 | } 28 | } 29 | } 30 | } 31 | -------------------------------------------------------------------------------- /README.md: -------------------------------------------------------------------------------- 1 | # Vibration-monitoring 2 | ## 一套震动监测系统,实现功能有用户管理,串口接收,Mysql存储,实时波形,历史报表 3 | 4 | 5 | * **开发语言:C#** 6 | * **UI界面:WinForm** 7 | * **数据库:MySQL** 8 | 9 | ## 系统实现的功能有 10 | * 串口通信 11 | * 实时波形显示 12 | * 数据库中存储数据 13 | * 历史数据波形显示 14 | * 历史数据报表显示 15 | * 用户登录 16 | * 用户分级管理 17 | 18 | ## 项目结构 19 | 20 | ### ConsoleApp1 21 | 22 | 开发过程中一些数据类型转换的测试,无项目引用关系 23 | 24 | ### 数据模拟发送 25 | 26 | 模拟下位机的串口数据发送的小程序 27 | 28 | 由于Windows操作系统的非实时性,数据发送间隔无法达到实际下位机的400us 29 | 30 | Tips:请配合虚拟串口软件使用 31 | 32 | ### WindowsFormsControlLibrary1 33 | 34 | 自定义控件项目,图标在**icon**文件夹中,**震动监测系统**需引用此项目 35 | 36 | ### 震动监测系统 37 | 38 | 主体项目,需要引用**WindowsFormsControlLibrary1**项目 39 | 40 | * controlconfig.cs 41 | * config文件操作类 42 | * 将串口参数保存至config文件中 43 | * CTMySql.cs 44 | * MySQL数据库操作类 45 | * CTSerialPort.cs 46 | * 串口操作类 47 | * DrawWave.cs 48 | * 在PictureBox控件中绘制波形的类 49 | * Form_SP_Set & Form_SP_Test 50 | * 串口参数设置 & 串口通信测试 界面 51 | * Form1 52 | * 主窗口界面 53 | * FormSaveWaiting 54 | * 存储数据时的进度条界面 55 | * FormSignIn 56 | * 登录窗口界面 57 | * FormWave 58 | * 实时波形显示界面 59 | * FormHistoryData 60 | * 历史数据**波形显示**及**报表输出**界面 61 | * FormUserManage 62 | * 用户管理界面 63 | 64 | 65 | 66 |

67 | Tonystkx@gmail.com 68 |

69 | 70 |

71 | 2020.05.15 72 |

73 | -------------------------------------------------------------------------------- /震动监测系统/震动监测系统DataSet.xsd: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | 9 | 10 | 11 | 12 | 13 | 14 | 15 | 16 | 17 | 18 | 19 | -------------------------------------------------------------------------------- /震动监测系统/Properties/Settings.Designer.cs: -------------------------------------------------------------------------------- 1 | //------------------------------------------------------------------------------ 2 | // 3 | // 此代码由工具生成。 4 | // 运行时版本:4.0.30319.42000 5 | // 6 | // 对此文件的更改可能会导致不正确的行为,并且如果 7 | // 重新生成代码,这些更改将会丢失。 8 | // 9 | //------------------------------------------------------------------------------ 10 | 11 | namespace 震动监测系统.Properties { 12 | 13 | 14 | [global::System.Runtime.CompilerServices.CompilerGeneratedAttribute()] 15 | [global::System.CodeDom.Compiler.GeneratedCodeAttribute("Microsoft.VisualStudio.Editors.SettingsDesigner.SettingsSingleFileGenerator", "16.5.0.0")] 16 | internal sealed partial class Settings : global::System.Configuration.ApplicationSettingsBase { 17 | 18 | private static Settings defaultInstance = ((Settings)(global::System.Configuration.ApplicationSettingsBase.Synchronized(new Settings()))); 19 | 20 | public static Settings Default { 21 | get { 22 | return defaultInstance; 23 | } 24 | } 25 | 26 | [global::System.Configuration.ApplicationScopedSettingAttribute()] 27 | [global::System.Diagnostics.DebuggerNonUserCodeAttribute()] 28 | [global::System.Configuration.SpecialSettingAttribute(global::System.Configuration.SpecialSetting.ConnectionString)] 29 | [global::System.Configuration.DefaultSettingValueAttribute("server=localhost;user id=root;persistsecurityinfo=True;database=震动监测系统")] 30 | public string DatabaseConnectionString { 31 | get { 32 | return ((string)(this["DatabaseConnectionString"])); 33 | } 34 | } 35 | } 36 | } 37 | -------------------------------------------------------------------------------- /icon/通信.svg: -------------------------------------------------------------------------------- 1 | 6 | -------------------------------------------------------------------------------- /震动监测系统.sln: -------------------------------------------------------------------------------- 1 | 2 | Microsoft Visual Studio Solution File, Format Version 12.00 3 | # Visual Studio Version 16 4 | VisualStudioVersion = 16.0.29905.134 5 | MinimumVisualStudioVersion = 10.0.40219.1 6 | Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "震动监测系统", "震动监测系统\震动监测系统.csproj", "{1E56599A-81FF-4A57-9D89-BA12BC0911F4}" 7 | EndProject 8 | Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "ConsoleApp1", "ConsoleApp1\ConsoleApp1.csproj", "{C7E903BD-E5B4-4F00-B366-8BFC89060F7B}" 9 | EndProject 10 | Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "数据模拟发送", "数据模拟发送\数据模拟发送.csproj", "{43E32EB0-0AC5-43AF-8FAB-E1B6578E534C}" 11 | EndProject 12 | Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "WindowsFormsControlLibrary1", "WindowsFormsControlLibrary1\WindowsFormsControlLibrary1.csproj", "{FB55F73E-451C-4012-B90E-A6AF9BA7E22E}" 13 | EndProject 14 | Global 15 | GlobalSection(SolutionConfigurationPlatforms) = preSolution 16 | Debug|Any CPU = Debug|Any CPU 17 | Release|Any CPU = Release|Any CPU 18 | EndGlobalSection 19 | GlobalSection(ProjectConfigurationPlatforms) = postSolution 20 | {1E56599A-81FF-4A57-9D89-BA12BC0911F4}.Debug|Any CPU.ActiveCfg = Debug|Any CPU 21 | {1E56599A-81FF-4A57-9D89-BA12BC0911F4}.Debug|Any CPU.Build.0 = Debug|Any CPU 22 | {1E56599A-81FF-4A57-9D89-BA12BC0911F4}.Release|Any CPU.ActiveCfg = Release|Any CPU 23 | {1E56599A-81FF-4A57-9D89-BA12BC0911F4}.Release|Any CPU.Build.0 = Release|Any CPU 24 | {C7E903BD-E5B4-4F00-B366-8BFC89060F7B}.Debug|Any CPU.ActiveCfg = Debug|Any CPU 25 | {C7E903BD-E5B4-4F00-B366-8BFC89060F7B}.Debug|Any CPU.Build.0 = Debug|Any CPU 26 | {C7E903BD-E5B4-4F00-B366-8BFC89060F7B}.Release|Any CPU.ActiveCfg = Release|Any CPU 27 | {C7E903BD-E5B4-4F00-B366-8BFC89060F7B}.Release|Any CPU.Build.0 = Release|Any CPU 28 | {43E32EB0-0AC5-43AF-8FAB-E1B6578E534C}.Debug|Any CPU.ActiveCfg = Debug|Any CPU 29 | {43E32EB0-0AC5-43AF-8FAB-E1B6578E534C}.Debug|Any CPU.Build.0 = Debug|Any CPU 30 | {43E32EB0-0AC5-43AF-8FAB-E1B6578E534C}.Release|Any CPU.ActiveCfg = Release|Any CPU 31 | {43E32EB0-0AC5-43AF-8FAB-E1B6578E534C}.Release|Any CPU.Build.0 = Release|Any CPU 32 | {FB55F73E-451C-4012-B90E-A6AF9BA7E22E}.Debug|Any CPU.ActiveCfg = Debug|Any CPU 33 | {FB55F73E-451C-4012-B90E-A6AF9BA7E22E}.Debug|Any CPU.Build.0 = Debug|Any CPU 34 | {FB55F73E-451C-4012-B90E-A6AF9BA7E22E}.Release|Any CPU.ActiveCfg = Release|Any CPU 35 | {FB55F73E-451C-4012-B90E-A6AF9BA7E22E}.Release|Any CPU.Build.0 = Release|Any CPU 36 | EndGlobalSection 37 | GlobalSection(SolutionProperties) = preSolution 38 | HideSolutionNode = FALSE 39 | EndGlobalSection 40 | GlobalSection(ExtensibilityGlobals) = postSolution 41 | SolutionGuid = {A59683D8-3B75-4170-8137-FDD6F66DB016} 42 | EndGlobalSection 43 | EndGlobal 44 | -------------------------------------------------------------------------------- /数据模拟发送/Properties/Resources.Designer.cs: -------------------------------------------------------------------------------- 1 | //------------------------------------------------------------------------------ 2 | // 3 | // 此代码由工具生成。 4 | // 运行时版本: 4.0.30319.42000 5 | // 6 | // 对此文件的更改可能导致不正确的行为,如果 7 | // 重新生成代码,则所做更改将丢失。 8 | // 9 | //------------------------------------------------------------------------------ 10 | 11 | namespace 数据模拟发送.Properties 12 | { 13 | 14 | 15 | /// 16 | /// 强类型资源类,用于查找本地化字符串等。 17 | /// 18 | // 此类是由 StronglyTypedResourceBuilder 19 | // 类通过类似于 ResGen 或 Visual Studio 的工具自动生成的。 20 | // 若要添加或删除成员,请编辑 .ResX 文件,然后重新运行 ResGen 21 | // (以 /str 作为命令选项),或重新生成 VS 项目。 22 | [global::System.CodeDom.Compiler.GeneratedCodeAttribute("System.Resources.Tools.StronglyTypedResourceBuilder", "4.0.0.0")] 23 | [global::System.Diagnostics.DebuggerNonUserCodeAttribute()] 24 | [global::System.Runtime.CompilerServices.CompilerGeneratedAttribute()] 25 | internal class Resources 26 | { 27 | 28 | private static global::System.Resources.ResourceManager resourceMan; 29 | 30 | private static global::System.Globalization.CultureInfo resourceCulture; 31 | 32 | [global::System.Diagnostics.CodeAnalysis.SuppressMessageAttribute("Microsoft.Performance", "CA1811:AvoidUncalledPrivateCode")] 33 | internal Resources() 34 | { 35 | } 36 | 37 | /// 38 | /// 返回此类使用的缓存 ResourceManager 实例。 39 | /// 40 | [global::System.ComponentModel.EditorBrowsableAttribute(global::System.ComponentModel.EditorBrowsableState.Advanced)] 41 | internal static global::System.Resources.ResourceManager ResourceManager 42 | { 43 | get 44 | { 45 | if ((resourceMan == null)) 46 | { 47 | global::System.Resources.ResourceManager temp = new global::System.Resources.ResourceManager("数据模拟发送.Properties.Resources", typeof(Resources).Assembly); 48 | resourceMan = temp; 49 | } 50 | return resourceMan; 51 | } 52 | } 53 | 54 | /// 55 | /// 覆盖当前线程的 CurrentUICulture 属性 56 | /// 使用此强类型的资源类的资源查找。 57 | /// 58 | [global::System.ComponentModel.EditorBrowsableAttribute(global::System.ComponentModel.EditorBrowsableState.Advanced)] 59 | internal static global::System.Globalization.CultureInfo Culture 60 | { 61 | get 62 | { 63 | return resourceCulture; 64 | } 65 | set 66 | { 67 | resourceCulture = value; 68 | } 69 | } 70 | } 71 | } 72 | -------------------------------------------------------------------------------- /震动监测系统/Properties/Resources.Designer.cs: -------------------------------------------------------------------------------- 1 | //------------------------------------------------------------------------------ 2 | // 3 | // 此代码由工具生成。 4 | // 运行时版本: 4.0.30319.42000 5 | // 6 | // 对此文件的更改可能导致不正确的行为,如果 7 | // 重新生成代码,则所做更改将丢失。 8 | // 9 | //------------------------------------------------------------------------------ 10 | 11 | namespace 震动监测系统.Properties 12 | { 13 | 14 | 15 | /// 16 | /// 强类型资源类,用于查找本地化字符串等。 17 | /// 18 | // 此类是由 StronglyTypedResourceBuilder 19 | // 类通过类似于 ResGen 或 Visual Studio 的工具自动生成的。 20 | // 若要添加或删除成员,请编辑 .ResX 文件,然后重新运行 ResGen 21 | // (以 /str 作为命令选项),或重新生成 VS 项目。 22 | [global::System.CodeDom.Compiler.GeneratedCodeAttribute("System.Resources.Tools.StronglyTypedResourceBuilder", "4.0.0.0")] 23 | [global::System.Diagnostics.DebuggerNonUserCodeAttribute()] 24 | [global::System.Runtime.CompilerServices.CompilerGeneratedAttribute()] 25 | internal class Resources 26 | { 27 | 28 | private static global::System.Resources.ResourceManager resourceMan; 29 | 30 | private static global::System.Globalization.CultureInfo resourceCulture; 31 | 32 | [global::System.Diagnostics.CodeAnalysis.SuppressMessageAttribute("Microsoft.Performance", "CA1811:AvoidUncalledPrivateCode")] 33 | internal Resources() 34 | { 35 | } 36 | 37 | /// 38 | /// 返回此类使用的缓存 ResourceManager 实例。 39 | /// 40 | [global::System.ComponentModel.EditorBrowsableAttribute(global::System.ComponentModel.EditorBrowsableState.Advanced)] 41 | internal static global::System.Resources.ResourceManager ResourceManager 42 | { 43 | get 44 | { 45 | if ((resourceMan == null)) 46 | { 47 | global::System.Resources.ResourceManager temp = new global::System.Resources.ResourceManager("震动监测系统.Properties.Resources", typeof(Resources).Assembly); 48 | resourceMan = temp; 49 | } 50 | return resourceMan; 51 | } 52 | } 53 | 54 | /// 55 | /// 覆盖当前线程的 CurrentUICulture 属性 56 | /// 使用此强类型的资源类的资源查找。 57 | /// 58 | [global::System.ComponentModel.EditorBrowsableAttribute(global::System.ComponentModel.EditorBrowsableState.Advanced)] 59 | internal static global::System.Globalization.CultureInfo Culture 60 | { 61 | get 62 | { 63 | return resourceCulture; 64 | } 65 | set 66 | { 67 | resourceCulture = value; 68 | } 69 | } 70 | } 71 | } 72 | -------------------------------------------------------------------------------- /.gitattributes: -------------------------------------------------------------------------------- 1 | ############################################################################### 2 | # Set default behavior to automatically normalize line endings. 3 | ############################################################################### 4 | * text=auto 5 | 6 | ############################################################################### 7 | # Set default behavior for command prompt diff. 8 | # 9 | # This is need for earlier builds of msysgit that does not have it on by 10 | # default for csharp files. 11 | # Note: This is only used by command line 12 | ############################################################################### 13 | #*.cs diff=csharp 14 | 15 | ############################################################################### 16 | # Set the merge driver for project and solution files 17 | # 18 | # Merging from the command prompt will add diff markers to the files if there 19 | # are conflicts (Merging from VS is not affected by the settings below, in VS 20 | # the diff markers are never inserted). Diff markers may cause the following 21 | # file extensions to fail to load in VS. An alternative would be to treat 22 | # these files as binary and thus will always conflict and require user 23 | # intervention with every merge. To do so, just uncomment the entries below 24 | ############################################################################### 25 | #*.sln merge=binary 26 | #*.csproj merge=binary 27 | #*.vbproj merge=binary 28 | #*.vcxproj merge=binary 29 | #*.vcproj merge=binary 30 | #*.dbproj merge=binary 31 | #*.fsproj merge=binary 32 | #*.lsproj merge=binary 33 | #*.wixproj merge=binary 34 | #*.modelproj merge=binary 35 | #*.sqlproj merge=binary 36 | #*.wwaproj merge=binary 37 | 38 | ############################################################################### 39 | # behavior for image files 40 | # 41 | # image files are treated as binary by default. 42 | ############################################################################### 43 | #*.jpg binary 44 | #*.png binary 45 | #*.gif binary 46 | 47 | ############################################################################### 48 | # diff behavior for common document formats 49 | # 50 | # Convert binary document formats to text before diffing them. This feature 51 | # is only available from the command line. Turn it on by uncommenting the 52 | # entries below. 53 | ############################################################################### 54 | #*.doc diff=astextplain 55 | #*.DOC diff=astextplain 56 | #*.docx diff=astextplain 57 | #*.DOCX diff=astextplain 58 | #*.dot diff=astextplain 59 | #*.DOT diff=astextplain 60 | #*.pdf diff=astextplain 61 | #*.PDF diff=astextplain 62 | #*.rtf diff=astextplain 63 | #*.RTF diff=astextplain 64 | -------------------------------------------------------------------------------- /WindowsFormsControlLibrary1/Properties/Resources.Designer.cs: -------------------------------------------------------------------------------- 1 | //------------------------------------------------------------------------------ 2 | // 3 | // 此代码由工具生成。 4 | // 运行时版本:4.0.30319.42000 5 | // 6 | // 对此文件的更改可能会导致不正确的行为,并且如果 7 | // 重新生成代码,这些更改将会丢失。 8 | // 9 | //------------------------------------------------------------------------------ 10 | 11 | namespace WindowsFormsControlLibrary1.Properties { 12 | using System; 13 | 14 | 15 | /// 16 | /// 一个强类型的资源类,用于查找本地化的字符串等。 17 | /// 18 | // 此类是由 StronglyTypedResourceBuilder 19 | // 类通过类似于 ResGen 或 Visual Studio 的工具自动生成的。 20 | // 若要添加或移除成员,请编辑 .ResX 文件,然后重新运行 ResGen 21 | // (以 /str 作为命令选项),或重新生成 VS 项目。 22 | [global::System.CodeDom.Compiler.GeneratedCodeAttribute("System.Resources.Tools.StronglyTypedResourceBuilder", "16.0.0.0")] 23 | [global::System.Diagnostics.DebuggerNonUserCodeAttribute()] 24 | [global::System.Runtime.CompilerServices.CompilerGeneratedAttribute()] 25 | internal class Resources { 26 | 27 | private static global::System.Resources.ResourceManager resourceMan; 28 | 29 | private static global::System.Globalization.CultureInfo resourceCulture; 30 | 31 | [global::System.Diagnostics.CodeAnalysis.SuppressMessageAttribute("Microsoft.Performance", "CA1811:AvoidUncalledPrivateCode")] 32 | internal Resources() { 33 | } 34 | 35 | /// 36 | /// 返回此类使用的缓存的 ResourceManager 实例。 37 | /// 38 | [global::System.ComponentModel.EditorBrowsableAttribute(global::System.ComponentModel.EditorBrowsableState.Advanced)] 39 | internal static global::System.Resources.ResourceManager ResourceManager { 40 | get { 41 | if (object.ReferenceEquals(resourceMan, null)) { 42 | global::System.Resources.ResourceManager temp = new global::System.Resources.ResourceManager("WindowsFormsControlLibrary1.Properties.Resources", typeof(Resources).Assembly); 43 | resourceMan = temp; 44 | } 45 | return resourceMan; 46 | } 47 | } 48 | 49 | /// 50 | /// 重写当前线程的 CurrentUICulture 属性 51 | /// 重写当前线程的 CurrentUICulture 属性。 52 | /// 53 | [global::System.ComponentModel.EditorBrowsableAttribute(global::System.ComponentModel.EditorBrowsableState.Advanced)] 54 | internal static global::System.Globalization.CultureInfo Culture { 55 | get { 56 | return resourceCulture; 57 | } 58 | set { 59 | resourceCulture = value; 60 | } 61 | } 62 | } 63 | } 64 | -------------------------------------------------------------------------------- /数据模拟发送/controlconfig.cs: -------------------------------------------------------------------------------- 1 | using System; 2 | using System.Collections.Generic; 3 | using System.Linq; 4 | using System.Text; 5 | using System.Threading.Tasks; 6 | using System.Configuration; 7 | 8 | namespace 数据模拟发送 9 | { 10 | static class controlconfig 11 | { 12 | //添加键为keyName、值为keyValue的项: 13 | public static void addItem(string keyName, string keyValue) 14 | { 15 | //添加配置文件的项,键为keyName,值为keyValue 16 | Configuration config = ConfigurationManager.OpenExeConfiguration(ConfigurationUserLevel.None); 17 | config.AppSettings.Settings.Add(keyName, keyValue); 18 | config.Save(ConfigurationSaveMode.Modified); 19 | ConfigurationManager.RefreshSection("appSettings"); 20 | } 21 | 22 | //判断键为keyName的项是否存在: 23 | public static bool existItem(string keyName) 24 | { 25 | //判断配置文件中是否存在键为keyName的项 26 | foreach (string key in ConfigurationManager.AppSettings) 27 | { 28 | if (key == keyName) 29 | { 30 | //存在 31 | return true; 32 | } 33 | } 34 | return false; 35 | } 36 | 37 | //获取键为keyName的项的值: 38 | public static string valueItem(string keyName) 39 | { 40 | //返回配置文件中键为keyName的项的值 41 | return ConfigurationManager.AppSettings[keyName]; 42 | } 43 | 44 | //修改键为keyName的项的值: 45 | public static void modifyItem(string keyName, string newKeyValue) 46 | { 47 | //修改配置文件中键为keyName的项的值 48 | Configuration config = ConfigurationManager.OpenExeConfiguration(ConfigurationUserLevel.None); 49 | config.AppSettings.Settings[keyName].Value = newKeyValue; 50 | config.Save(ConfigurationSaveMode.Modified); 51 | ConfigurationManager.RefreshSection("appSettings"); 52 | } 53 | 54 | //删除键为keyName的项: 55 | public static void removeItem(string keyName) 56 | { 57 | //删除配置文件键为keyName的项 58 | Configuration config = ConfigurationManager.OpenExeConfiguration(ConfigurationUserLevel.None); 59 | config.AppSettings.Settings.Remove(keyName); 60 | config.Save(ConfigurationSaveMode.Modified); 61 | ConfigurationManager.RefreshSection("appSettings"); 62 | } 63 | 64 | /// 65 | /// 自动判断是否存在Item 66 | /// 若存在,修改值 67 | /// 不存在,添加值 68 | /// 69 | /// 70 | public static void AddOrModifyItem(string keyName, string newKeyValue) 71 | { 72 | if (existItem(keyName)) 73 | { 74 | modifyItem(keyName, newKeyValue); 75 | } 76 | else 77 | { 78 | addItem(keyName, newKeyValue); 79 | } 80 | } 81 | } 82 | } 83 | -------------------------------------------------------------------------------- /震动监测系统/FormSaveWaiting.Designer.cs: -------------------------------------------------------------------------------- 1 | namespace 震动监测系统 2 | { 3 | partial class FormSaveWaiting 4 | { 5 | /// 6 | /// Required designer variable. 7 | /// 8 | private System.ComponentModel.IContainer components = null; 9 | 10 | /// 11 | /// Clean up any resources being used. 12 | /// 13 | /// true if managed resources should be disposed; otherwise, false. 14 | protected override void Dispose(bool disposing) 15 | { 16 | if (disposing && (components != null)) 17 | { 18 | components.Dispose(); 19 | } 20 | base.Dispose(disposing); 21 | } 22 | 23 | #region Windows Form Designer generated code 24 | 25 | /// 26 | /// Required method for Designer support - do not modify 27 | /// the contents of this method with the code editor. 28 | /// 29 | private void InitializeComponent() 30 | { 31 | this.progressBar1 = new System.Windows.Forms.ProgressBar(); 32 | this.label1 = new System.Windows.Forms.Label(); 33 | this.SuspendLayout(); 34 | // 35 | // progressBar1 36 | // 37 | this.progressBar1.Location = new System.Drawing.Point(12, 12); 38 | this.progressBar1.Name = "progressBar1"; 39 | this.progressBar1.Size = new System.Drawing.Size(410, 23); 40 | this.progressBar1.TabIndex = 0; 41 | // 42 | // label1 43 | // 44 | this.label1.AutoSize = true; 45 | this.label1.Location = new System.Drawing.Point(200, 51); 46 | this.label1.Name = "label1"; 47 | this.label1.Size = new System.Drawing.Size(41, 12); 48 | this.label1.TabIndex = 1; 49 | this.label1.Text = "label1"; 50 | // 51 | // FormSaveWaiting 52 | // 53 | this.AutoScaleDimensions = new System.Drawing.SizeF(6F, 12F); 54 | this.AutoScaleMode = System.Windows.Forms.AutoScaleMode.Font; 55 | this.ClientSize = new System.Drawing.Size(434, 81); 56 | this.Controls.Add(this.label1); 57 | this.Controls.Add(this.progressBar1); 58 | this.FormBorderStyle = System.Windows.Forms.FormBorderStyle.FixedSingle; 59 | this.MaximizeBox = false; 60 | this.MinimizeBox = false; 61 | this.Name = "FormSaveWaiting"; 62 | this.ShowIcon = false; 63 | this.StartPosition = System.Windows.Forms.FormStartPosition.CenterParent; 64 | this.Text = "FormSaveWaiting"; 65 | this.TopMost = true; 66 | this.ResumeLayout(false); 67 | this.PerformLayout(); 68 | 69 | } 70 | 71 | #endregion 72 | 73 | private System.Windows.Forms.ProgressBar progressBar1; 74 | private System.Windows.Forms.Label label1; 75 | } 76 | } -------------------------------------------------------------------------------- /ConsoleApp1/Program.cs: -------------------------------------------------------------------------------- 1 | using System; 2 | 3 | namespace ConsoleApp1 4 | { 5 | class Program 6 | { 7 | static void Main(string[] args) 8 | { 9 | //byte to uint16 输入顺序需注意为低位在前 10 | //byte x1 = Convert.ToByte(255), x2 = Convert.ToByte(0), x3 = Convert.ToByte(0), x4 = Convert.ToByte(255); 11 | //byte[] bt = { 255, 0, 0, 255 }; 12 | //UInt16 a = BitConverter.ToUInt16(bt, 0); 13 | //UInt16 b = BitConverter.ToUInt16(bt, 2); 14 | //Console.WriteLine(byte.MaxValue.ToString(), byte.MinValue.ToString()); 15 | //Console.WriteLine("touint16:{0}" ,a); 16 | //Console.WriteLine("touint16:{0}", b); 17 | 18 | //另一种方法 19 | //byte bb = 255, cc = 255; 20 | //int bb1 = bb * 256; 21 | //Console.WriteLine("touint16:{0}", bb1); 22 | //bb1 += cc; 23 | //Console.WriteLine("touint16:{0}", bb1); 24 | 25 | //string to uint16 26 | //string str = "0xff01"; 27 | //UInt16 stra; 28 | //stra = Convert.ToUInt16(str, 16); 29 | //Console.WriteLine("touint16:{0}", stra); 30 | //str = "65535"; 31 | //stra = Convert.ToUInt16(str); 32 | //Console.WriteLine("touint16:{0}", stra); 33 | //uint16 to byte 输出顺序为低位在前 34 | //byte[] bt = BitConverter.GetBytes(stra); 35 | //Console.WriteLine("uint16tobyte:{0}", bt[0].ToString()); 36 | //Console.WriteLine("uint16tobyte:{0}", bt[1].ToString()); 37 | 38 | //随机数 39 | //UInt16 mid = 30000, range = 100; 40 | //Random r = new Random(); 41 | //UInt16 s = (UInt16)r.Next(mid - range / 2, mid + range / 2); 42 | //Console.WriteLine(s.ToString()); 43 | 44 | //将百微秒转为H:M:S:MS:US形式 45 | //uint ms = 42326548; 46 | ////Console.WriteLine("ms: " + ms.ToString()); 47 | ////string msstr = ms.ToString(); 48 | ////ms = Convert.ToSingle(msstr); 49 | //Console.WriteLine("ms: " + ms.ToString()); 50 | //Console.WriteLine(DateTime.Now.ToString() + "." + DateTime.Now.Millisecond.ToString()); 51 | //uint hour = Convert.ToUInt32( ms / 36000000 ); 52 | //uint min = Convert.ToUInt32((ms % 36000000) / 600000); 53 | //uint sec = Convert.ToUInt32(((ms % 36000000) % 600000) / 10000); 54 | //uint msec = Convert.ToUInt32(((ms % 36000000) % 600000) % 10000 / 10); 55 | //uint usec = Convert.ToUInt32(((ms % 36000000) % 600000) % 10000 % 10); 56 | //Console.WriteLine("hour: " + hour.ToString() + 57 | // " min: " + min.ToString() + 58 | // " sec: " + sec.ToString() + 59 | // " msec: " + msec.ToString() + 60 | // " usec: " + (usec*100).ToString()); 61 | //Console.WriteLine(DateTime.Now.ToString() + "." + DateTime.Now.Millisecond.ToString()); 62 | 63 | //uint16 to hex 64 | UInt16[] n = new ushort[4] { 12, 11, 10, 9 }; 65 | Console.WriteLine(n[0].ToString("X4")); 66 | 67 | } 68 | } 69 | } 70 | -------------------------------------------------------------------------------- /WindowsFormsControlLibrary1/WindowsFormsControlLibrary1.csproj: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | Debug 6 | AnyCPU 7 | {FB55F73E-451C-4012-B90E-A6AF9BA7E22E} 8 | Library 9 | WindowsFormsControlLibrary1 10 | WindowsFormsControlLibrary1 11 | v4.7.2 12 | 512 13 | true 14 | 15 | 16 | true 17 | full 18 | false 19 | bin\Debug\ 20 | DEBUG;TRACE 21 | prompt 22 | 4 23 | 24 | 25 | pdbonly 26 | true 27 | bin\Release\ 28 | TRACE 29 | prompt 30 | 4 31 | 32 | 33 | 34 | 35 | 36 | 37 | 38 | 39 | 40 | 41 | 42 | 43 | 44 | 45 | 46 | UserControl 47 | 48 | 49 | MyButton.cs 50 | 51 | 52 | 53 | True 54 | True 55 | Resources.resx 56 | 57 | 58 | 59 | 60 | 61 | MyButton.cs 62 | 63 | 64 | ResXFileCodeGenerator 65 | Resources.Designer.cs 66 | 67 | 68 | 69 | -------------------------------------------------------------------------------- /WindowsFormsControlLibrary1/MyButton.Designer.cs: -------------------------------------------------------------------------------- 1 | using System; 2 | 3 | namespace WindowsFormsControlLibrary1 4 | { 5 | partial class MyButton 6 | { 7 | /// 8 | /// 必需的设计器变量。 9 | /// 10 | private System.ComponentModel.IContainer components = null; 11 | 12 | /// 13 | /// 清理所有正在使用的资源。 14 | /// 15 | /// 如果应释放托管资源,为 true;否则为 false。 16 | protected override void Dispose(bool disposing) 17 | { 18 | if (disposing && (components != null)) 19 | { 20 | components.Dispose(); 21 | } 22 | base.Dispose(disposing); 23 | } 24 | 25 | #region 组件设计器生成的代码 26 | 27 | /// 28 | /// 设计器支持所需的方法 - 不要修改 29 | /// 使用代码编辑器修改此方法的内容。 30 | /// 31 | private void InitializeComponent() 32 | { 33 | System.ComponentModel.ComponentResourceManager resources = new System.ComponentModel.ComponentResourceManager(typeof(MyButton)); 34 | this.pictureBox1 = new System.Windows.Forms.PictureBox(); 35 | this.label1 = new System.Windows.Forms.Label(); 36 | ((System.ComponentModel.ISupportInitialize)(this.pictureBox1)).BeginInit(); 37 | this.SuspendLayout(); 38 | // 39 | // pictureBox1 40 | // 41 | this.pictureBox1.BackColor = System.Drawing.Color.Transparent; 42 | this.pictureBox1.BackgroundImage = ((System.Drawing.Image)(resources.GetObject("pictureBox1.BackgroundImage"))); 43 | this.pictureBox1.BackgroundImageLayout = System.Windows.Forms.ImageLayout.Zoom; 44 | this.pictureBox1.Location = new System.Drawing.Point(2, 2); 45 | this.pictureBox1.Margin = new System.Windows.Forms.Padding(2); 46 | this.pictureBox1.Name = "pictureBox1"; 47 | this.pictureBox1.Size = new System.Drawing.Size(70, 48); 48 | this.pictureBox1.TabIndex = 0; 49 | this.pictureBox1.TabStop = false; 50 | this.pictureBox1.Click += new System.EventHandler(this.pictureBox1_Click); 51 | this.pictureBox1.MouseEnter += new System.EventHandler(this.pictureBox1_MouseEnter); 52 | this.pictureBox1.MouseLeave += new System.EventHandler(this.pictureBox1_MouseLeave); 53 | // 54 | // label1 55 | // 56 | this.label1.AutoSize = true; 57 | this.label1.Font = new System.Drawing.Font("黑体", 12F, System.Drawing.FontStyle.Bold, System.Drawing.GraphicsUnit.Point, ((byte)(134))); 58 | this.label1.Location = new System.Drawing.Point(2, 46); 59 | this.label1.Margin = new System.Windows.Forms.Padding(2, 0, 2, 0); 60 | this.label1.Name = "label1"; 61 | this.label1.Size = new System.Drawing.Size(76, 16); 62 | this.label1.TabIndex = 1; 63 | this.label1.Text = "组合按钮"; 64 | this.label1.Click += new System.EventHandler(this.label1_Click); 65 | this.label1.MouseEnter += new System.EventHandler(this.label1_MouseEnter); 66 | this.label1.MouseLeave += new System.EventHandler(this.label1_MouseLeave); 67 | // 68 | // MyButton 69 | // 70 | this.AutoScaleDimensions = new System.Drawing.SizeF(6F, 12F); 71 | this.AutoScaleMode = System.Windows.Forms.AutoScaleMode.Font; 72 | this.BackColor = System.Drawing.Color.White; 73 | this.Controls.Add(this.label1); 74 | this.Controls.Add(this.pictureBox1); 75 | this.Margin = new System.Windows.Forms.Padding(2); 76 | this.Name = "MyButton"; 77 | this.Size = new System.Drawing.Size(75, 64); 78 | this.Click += new System.EventHandler(this.MyButton_Click); 79 | this.Paint += new System.Windows.Forms.PaintEventHandler(this.MyButton_Paint); 80 | this.MouseEnter += new System.EventHandler(this.MyButton_MouseEnter); 81 | this.MouseLeave += new System.EventHandler(this.MyButton_MouseLeave); 82 | ((System.ComponentModel.ISupportInitialize)(this.pictureBox1)).EndInit(); 83 | this.ResumeLayout(false); 84 | this.PerformLayout(); 85 | 86 | } 87 | 88 | 89 | 90 | #endregion 91 | 92 | private System.Windows.Forms.PictureBox pictureBox1; 93 | private System.Windows.Forms.Label label1; 94 | } 95 | } 96 | -------------------------------------------------------------------------------- /震动监测系统/FormSaveWaiting.cs: -------------------------------------------------------------------------------- 1 | using System; 2 | using System.Collections.Generic; 3 | using System.ComponentModel; 4 | using System.Data; 5 | using System.Drawing; 6 | using System.Linq; 7 | using System.Text; 8 | using System.Threading.Tasks; 9 | using System.Windows.Forms; 10 | using System.Threading; 11 | 12 | namespace 震动监测系统 13 | { 14 | public partial class FormSaveWaiting : Form 15 | { 16 | static public int pv1 = 0; 17 | CTMySql cm = new CTMySql(); 18 | static public object tLock = new object(); 19 | 20 | public FormSaveWaiting() 21 | { 22 | InitializeComponent(); 23 | 24 | int dtstnum = CTMySql.dtst.Tables.Count; 25 | cm.CreateNewTable(CTMySql.dtst.Tables[dtstnum - 2].TableName); 26 | cm.CreateNewTable(CTMySql.dtst.Tables[dtstnum - 1].TableName); 27 | 28 | Thread T1 = new Thread(D1); 29 | Thread T2 = new Thread(D2); 30 | T1.IsBackground = true; 31 | T2.IsBackground = true; 32 | T1.Start(); 33 | T2.Start(); 34 | 35 | Thread wt = new Thread(w); 36 | wt.IsBackground = true; 37 | wt.Start(); 38 | } 39 | 40 | void D1() 41 | { 42 | int dtstnum = CTMySql.dtst.Tables.Count; 43 | SaveDelet1 sd1 = new SaveDelet1(CTMySql.dtst.Tables[dtstnum - 2].TableName); 44 | sd1.Savep(); 45 | } 46 | void D2() 47 | { 48 | int dtstnum = CTMySql.dtst.Tables.Count; 49 | SaveDelet2 sd2 = new SaveDelet2(CTMySql.dtst.Tables[dtstnum - 1].TableName); 50 | sd2.Savep(); 51 | } 52 | 53 | void w() 54 | { 55 | int o = pv1, v = 0; 56 | while (pv1 != 100) 57 | { 58 | if (0 != pv1) 59 | { 60 | o = (pv1 + o) / 2; 61 | //o = pv1; 62 | } 63 | progressBar1.Value = o; 64 | 65 | label1.Text = o.ToString(); 66 | Thread.Sleep(100); 67 | } 68 | progressBar1.Value = 100; 69 | label1.Text = "储存完成"; 70 | } 71 | } 72 | 73 | class SaveDelet1 74 | { 75 | CTMySql cm = new CTMySql(); 76 | DataTable dt; 77 | 78 | string tn; 79 | 80 | public SaveDelet1(string _tn) 81 | { 82 | tn = _tn; 83 | dt = CTMySql.dtst.Tables[_tn]; 84 | } 85 | 86 | public void Savep() 87 | { 88 | int num = 100, start = 0, all, loop; 89 | all = dt.Rows.Count; 90 | if (all <= 100) 91 | { 92 | loop = 1; 93 | } 94 | else 95 | { 96 | loop = all / 100 + 1; 97 | } 98 | for (int i = 0; i < loop; i++) 99 | { 100 | lock (FormSaveWaiting.tLock) 101 | { 102 | if (i == loop - 1) 103 | { 104 | if (loop != 1) 105 | { 106 | cm.AddOrUpdataTableFromDataset2Databass(tn, all % (loop - 1), start); 107 | } 108 | } 109 | else 110 | { 111 | cm.AddOrUpdataTableFromDataset2Databass(tn, num, start); 112 | start += num; 113 | } 114 | FormSaveWaiting.pv1 = i * 100 / loop; 115 | } 116 | } 117 | Delet(); 118 | FormSaveWaiting.pv1 = 100; 119 | } 120 | 121 | private void Delet() 122 | { 123 | CTMySql.dtst.Tables[tn].Clear(); 124 | } 125 | } 126 | 127 | class SaveDelet2 128 | { 129 | CTMySql cm = new CTMySql(); 130 | DataTable dt; 131 | 132 | string tn; 133 | 134 | public SaveDelet2(string _tn) 135 | { 136 | tn = _tn; 137 | dt = CTMySql.dtst.Tables[_tn]; 138 | } 139 | 140 | public void Savep() 141 | { 142 | int num = 100, start = 0, all, loop; 143 | all = dt.Rows.Count; 144 | if (all <= 100) 145 | { 146 | loop = 1; 147 | } 148 | else 149 | { 150 | loop = all / 100 + 1; 151 | } 152 | for (int i = 0; i < loop; i++) 153 | { 154 | lock (FormSaveWaiting.tLock) 155 | { 156 | if (i == loop - 1) 157 | { 158 | if (loop != 1) 159 | { 160 | cm.AddOrUpdataTableFromDataset2Databass(tn, all % (loop - 1), start); 161 | } 162 | } 163 | else 164 | { 165 | cm.AddOrUpdataTableFromDataset2Databass(tn, num, start); 166 | start += num; 167 | } 168 | FormSaveWaiting.pv1 = i * 100 / loop; 169 | } 170 | } 171 | Delet(); 172 | FormSaveWaiting.pv1 = 100; 173 | } 174 | 175 | private void Delet() 176 | { 177 | CTMySql.dtst.Tables[tn].Clear(); 178 | } 179 | } 180 | } 181 | -------------------------------------------------------------------------------- /数据模拟发送/数据模拟发送.csproj: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | Debug 6 | AnyCPU 7 | {43E32EB0-0AC5-43AF-8FAB-E1B6578E534C} 8 | WinExe 9 | 数据模拟发送 10 | 数据模拟发送 11 | v4.7.2 12 | 512 13 | true 14 | true 15 | false 16 | publish\ 17 | true 18 | Disk 19 | false 20 | Foreground 21 | 7 22 | Days 23 | false 24 | false 25 | true 26 | 2 27 | 1.0.0.%2a 28 | false 29 | true 30 | true 31 | 32 | 33 | AnyCPU 34 | true 35 | full 36 | false 37 | bin\Debug\ 38 | DEBUG;TRACE 39 | prompt 40 | 4 41 | 42 | 43 | AnyCPU 44 | pdbonly 45 | true 46 | bin\Release\ 47 | TRACE 48 | prompt 49 | 4 50 | 51 | 52 | 0E235FD412BCC81B5BFF3CF74A34CF35FED04879 53 | 54 | 55 | 数据模拟发送_TemporaryKey.pfx 56 | 57 | 58 | true 59 | 60 | 61 | false 62 | 63 | 64 | 65 | 66 | 67 | 68 | 69 | 70 | 71 | 72 | 73 | 74 | 75 | 76 | 77 | 78 | 79 | 80 | 81 | Form 82 | 83 | 84 | Form1.cs 85 | 86 | 87 | 88 | 89 | Form1.cs 90 | 91 | 92 | ResXFileCodeGenerator 93 | Resources.Designer.cs 94 | Designer 95 | 96 | 97 | True 98 | Resources.resx 99 | 100 | 101 | SettingsSingleFileGenerator 102 | Settings.Designer.cs 103 | 104 | 105 | True 106 | Settings.settings 107 | True 108 | 109 | 110 | 111 | 112 | 113 | 114 | 115 | 116 | False 117 | Microsoft .NET Framework 4.7.2 %28x86 和 x64%29 118 | true 119 | 120 | 121 | False 122 | .NET Framework 3.5 SP1 123 | false 124 | 125 | 126 | 127 | -------------------------------------------------------------------------------- /数据模拟发送/Properties/Resources.resx: -------------------------------------------------------------------------------- 1 | 2 | 3 | 62 | 63 | 64 | 65 | 66 | 67 | 68 | 69 | 70 | 71 | 72 | 73 | 74 | 75 | 76 | 77 | 78 | 79 | 80 | 81 | 82 | 83 | 84 | 85 | 86 | 87 | 88 | 89 | 90 | 91 | 92 | 93 | 94 | 95 | 96 | 97 | 98 | 99 | 100 | 101 | 102 | 103 | 104 | 105 | 106 | text/microsoft-resx 107 | 108 | 109 | 2.0 110 | 111 | 112 | System.Resources.ResXResourceReader, System.Windows.Forms, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089 113 | 114 | 115 | System.Resources.ResXResourceWriter, System.Windows.Forms, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089 116 | 117 | -------------------------------------------------------------------------------- /震动监测系统/Properties/Resources.resx: -------------------------------------------------------------------------------- 1 | 2 | 3 | 62 | 63 | 64 | 65 | 66 | 67 | 68 | 69 | 70 | 71 | 72 | 73 | 74 | 75 | 76 | 77 | 78 | 79 | 80 | 81 | 82 | 83 | 84 | 85 | 86 | 87 | 88 | 89 | 90 | 91 | 92 | 93 | 94 | 95 | 96 | 97 | 98 | 99 | 100 | 101 | 102 | 103 | 104 | 105 | 106 | text/microsoft-resx 107 | 108 | 109 | 2.0 110 | 111 | 112 | System.Resources.ResXResourceReader, System.Windows.Forms, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089 113 | 114 | 115 | System.Resources.ResXResourceWriter, System.Windows.Forms, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089 116 | 117 | -------------------------------------------------------------------------------- /数据模拟发送/CTSerialPort.cs: -------------------------------------------------------------------------------- 1 | using System; 2 | using System.Collections.Generic; 3 | using System.Linq; 4 | using System.Text; 5 | using System.Threading.Tasks; 6 | using System.IO.Ports; 7 | using System.Windows.Forms; 8 | 9 | namespace 数据模拟发送 10 | { 11 | static class CTSerialPort 12 | { 13 | 14 | static SerialPort sp = new SerialPort(); 15 | 16 | /// 17 | /// 设置串口通信参数 18 | /// 19 | /// 20 | /// 21 | /// 22 | /// 23 | public static bool SetSP(string comnum, int bodenum, int datanum, string stopnum) 24 | { 25 | if (sp.IsOpen) 26 | { 27 | sp.Close(); 28 | } 29 | if (datanum > 8 || datanum < 5) 30 | { 31 | MessageBox.Show("数据位参数范围为[5,8]"); 32 | return false; 33 | } 34 | sp.ReadBufferSize = 1; 35 | sp.PortName = comnum; 36 | sp.BaudRate = bodenum; 37 | sp.DataBits = datanum; 38 | switch (stopnum) 39 | { 40 | case "1": 41 | sp.StopBits = StopBits.One; 42 | break; 43 | case "2": 44 | sp.StopBits = StopBits.Two; 45 | break; 46 | case "1.5": 47 | sp.StopBits = StopBits.OnePointFive; 48 | break; 49 | default: 50 | MessageBox.Show("停止位参数错误"); 51 | break; 52 | } 53 | //sp.Encoding = UTF8Encoding.UTF8; 54 | return true; 55 | } 56 | public static bool SetSP(string comnum, string bodenum, string datanum, string stopnum) 57 | { 58 | if (sp.IsOpen) 59 | { 60 | sp.Close(); 61 | } 62 | int bodenumInt, datanumInt; 63 | if (!int.TryParse(bodenum, out bodenumInt)) 64 | { 65 | MessageBox.Show("波特率参数错误"); 66 | return false; 67 | } 68 | if (!int.TryParse(datanum, out datanumInt)) 69 | { 70 | MessageBox.Show("数据位参数错误"); 71 | return false; 72 | } 73 | if (datanumInt > 8 || datanumInt < 5) 74 | { 75 | MessageBox.Show("数据位参数范围为[5,8]"); 76 | return false; 77 | } 78 | //sp.ReadBufferSize = 1; 79 | sp.PortName = comnum; 80 | sp.BaudRate = int.Parse(bodenum); 81 | sp.DataBits = int.Parse(datanum); 82 | switch (stopnum) 83 | { 84 | case "1": 85 | sp.StopBits = StopBits.One; 86 | break; 87 | case "2": 88 | sp.StopBits = StopBits.Two; 89 | break; 90 | case "1.5": 91 | sp.StopBits = StopBits.OnePointFive; 92 | break; 93 | default: 94 | MessageBox.Show("停止位参数错误"); 95 | return false; 96 | break; 97 | } 98 | return true; 99 | } 100 | 101 | 102 | /// 103 | /// 打开串口 104 | /// 105 | /// 106 | /// 107 | /// 108 | /// 109 | /// 110 | public static bool OpenSP() 111 | { 112 | if (sp.IsOpen) 113 | { 114 | sp.Close(); 115 | } 116 | else 117 | { 118 | sp.Open(); 119 | } 120 | return sp.IsOpen; 121 | } 122 | 123 | 124 | /// 125 | /// 关闭串口 126 | /// true:关闭成功 127 | /// false:关闭失败 128 | /// 129 | /// 130 | public static bool CloseSP() 131 | { 132 | sp.Close(); 133 | return !sp.IsOpen; 134 | } 135 | 136 | 137 | /// 138 | /// 判断串口开闭状态 139 | /// true:打开状态 140 | /// false:关闭状态 141 | /// 142 | /// 143 | public static bool IsComOpen() 144 | { 145 | return sp.IsOpen; 146 | } 147 | 148 | 149 | /// 150 | /// 读取串口数据,缓冲区足够bfSize字节读取一次 151 | /// 152 | /// 153 | public static bool ReadSP(ref byte[] readData, int bfSize) 154 | { 155 | if (sp.BytesToRead >= bfSize) 156 | { 157 | sp.Read(readData, 0, 4); 158 | //Console.WriteLine("这是readExisting:" + sp.BytesToRead.ToString() + "\r\n" + readData); 159 | //sp.DiscardInBuffer(); 160 | return true; 161 | } 162 | else 163 | { 164 | return false; 165 | } 166 | } 167 | 168 | /// 169 | /// 发送串口数据 170 | /// 171 | /// 172 | /// 173 | public static bool SendSP(string sendData) 174 | { 175 | sp.Write(sendData); 176 | return true; 177 | } 178 | public static bool SendSP(byte[] sendData) 179 | { 180 | sp.Write(sendData, 0, 2); 181 | return true; 182 | } 183 | 184 | /// 185 | /// 清空输入缓存区 186 | /// 187 | public static void ClearInBuffer() 188 | { 189 | sp.DiscardInBuffer(); 190 | } 191 | } 192 | } 193 | -------------------------------------------------------------------------------- /WindowsFormsControlLibrary1/MyButton.cs: -------------------------------------------------------------------------------- 1 | using System; 2 | using System.Collections.Generic; 3 | using System.ComponentModel; 4 | using System.Drawing; 5 | using System.Data; 6 | using System.Linq; 7 | using System.Text; 8 | using System.Threading.Tasks; 9 | using System.Windows.Forms; 10 | 11 | namespace WindowsFormsControlLibrary1 12 | { 13 | public partial class MyButton: UserControl 14 | { 15 | static Point pt; 16 | 17 | public MyButton() 18 | { 19 | InitializeComponent(); 20 | } 21 | 22 | 23 | 24 | [Browsable(true), Category("自定义属性")] 25 | [Description("设置按钮文本")] 26 | public string TextAll 27 | { 28 | get 29 | { 30 | return label1.Text; 31 | } 32 | set 33 | { 34 | label1.Text = value; 35 | } 36 | } 37 | 38 | [Browsable(true), Category("自定义属性")] 39 | [Description("设置按钮文本颜色")] 40 | public Color FontColorAll 41 | { 42 | get 43 | { 44 | return label1.ForeColor; 45 | } 46 | set 47 | { 48 | label1.ForeColor = value; 49 | } 50 | } 51 | 52 | [Browsable(true),Category("自定义属性")] 53 | [Description("设置背景图片")] 54 | public Image BackGroundImageAll 55 | { 56 | get 57 | { 58 | return pictureBox1.BackgroundImage; 59 | } 60 | set 61 | { 62 | pictureBox1.BackgroundImage = value; 63 | } 64 | } 65 | 66 | [Browsable(true), Category("自定义属性")] 67 | [Description("设置背景图片匹配形式")] 68 | public ImageLayout BackgroundImageLayoutAll 69 | { 70 | get { return pictureBox1.BackgroundImageLayout; } 71 | set { pictureBox1.BackgroundImageLayout = value; } 72 | } 73 | 74 | [Browsable(true), Category("自定义属性")] 75 | [Description("设置背景颜色")] 76 | public Color BackColotAll 77 | { 78 | get 79 | { 80 | return this.BackColor; 81 | } 82 | set 83 | { 84 | this.BackColor = value; 85 | } 86 | } 87 | 88 | private void MyButton_Paint(object sender, PaintEventArgs e) 89 | { 90 | //设置label水平居中,高度处于58/80 91 | pt = new Point(this.Width, this.Height); 92 | pt.X = (pt.X - label1.Width) / 2; 93 | pt.Y = pt.Y * 58 / 80; 94 | label1.Location = pt; 95 | 96 | //设置picture水平居中,高度60/80 97 | Point a = new Point(3, 3); 98 | pictureBox1.Location = a; 99 | Size size = new Size(this.Width - 6, this.Height * 60 / 80); 100 | pictureBox1.Size = size; 101 | pictureBox1.BackgroundImageLayout = ImageLayout.Zoom; 102 | 103 | //设置button大小与All相等 104 | size = new Size(this.Width, this.Height); 105 | } 106 | 107 | // 点击事件 108 | public delegate void MyButtonClickHandle(object sender, EventArgs e);//委托声明 109 | [Category("自定义事件")] 110 | public event MyButtonClickHandle MyButtonClickEvent;//事件声明 111 | 112 | private void pictureBox1_Click(object sender, EventArgs e) 113 | { 114 | if (MyButtonClickEvent != null) 115 | { 116 | MyButtonClickEvent(sender, new EventArgs()); 117 | } 118 | } 119 | 120 | private void label1_Click(object sender, EventArgs e) 121 | { 122 | if (MyButtonClickEvent != null) 123 | { 124 | MyButtonClickEvent(sender, new EventArgs()); 125 | } 126 | } 127 | 128 | private void MyButton_Click(object sender, EventArgs e) 129 | { 130 | if (MyButtonClickEvent != null) 131 | { 132 | MyButtonClickEvent(sender, new EventArgs()); 133 | } 134 | } 135 | 136 | // 鼠标进入事件 137 | public delegate void MyButtonMouseInHandle(object sender, EventArgs e); 138 | [Category("自定义事件")] 139 | public event MyButtonMouseInHandle MouseInEvent; 140 | 141 | private void MyButton_MouseEnter(object sender, EventArgs e) 142 | { 143 | if (MouseInEvent != null) 144 | { 145 | MouseInEvent(sender, e); 146 | } 147 | } 148 | 149 | 150 | private void pictureBox1_MouseEnter(object sender, EventArgs e) 151 | { 152 | if (MouseInEvent != null) 153 | { 154 | MouseInEvent((object)(((PictureBox)sender).Parent), e); 155 | } 156 | } 157 | 158 | 159 | private void label1_MouseEnter(object sender, EventArgs e) 160 | { 161 | if (MouseInEvent != null) 162 | { 163 | MouseInEvent((object)(((Label)sender).Parent), e); 164 | } 165 | } 166 | 167 | 168 | // 鼠标离开事件 169 | public delegate void MyButtonMouseLevaeHandle(object sender, EventArgs e); 170 | [Category("自定义事件")] 171 | public event MyButtonMouseLevaeHandle MouseLeaveEvent; 172 | 173 | private void label1_MouseLeave(object sender, EventArgs e) 174 | { 175 | if (MouseInEvent != null) 176 | { 177 | MouseLeaveEvent((object)(((Label)sender).Parent), e); 178 | } 179 | } 180 | 181 | private void pictureBox1_MouseLeave(object sender, EventArgs e) 182 | { 183 | if (MouseInEvent != null) 184 | { 185 | MouseLeaveEvent((object)(((PictureBox)sender).Parent), e); 186 | } 187 | } 188 | 189 | private void MyButton_MouseLeave(object sender, EventArgs e) 190 | { 191 | if (MouseInEvent != null) 192 | { 193 | MouseLeaveEvent(sender, e); 194 | } 195 | } 196 | } 197 | } 198 | -------------------------------------------------------------------------------- /数据模拟发送/Form1.resx: -------------------------------------------------------------------------------- 1 | 2 | 3 | 62 | 63 | 64 | 65 | 66 | 67 | 68 | 69 | 70 | 71 | 72 | 73 | 74 | 75 | 76 | 77 | 78 | 79 | 80 | 81 | 82 | 83 | 84 | 85 | 86 | 87 | 88 | 89 | 90 | 91 | 92 | 93 | 94 | 95 | 96 | 97 | 98 | 99 | 100 | 101 | 102 | 103 | 104 | 105 | 106 | 107 | 108 | 109 | text/microsoft-resx 110 | 111 | 112 | 2.0 113 | 114 | 115 | System.Resources.ResXResourceReader, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089 116 | 117 | 118 | System.Resources.ResXResourceWriter, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089 119 | 120 | -------------------------------------------------------------------------------- /震动监测系统/FormSaveWaiting.resx: -------------------------------------------------------------------------------- 1 | 2 | 3 | 62 | 63 | 64 | 65 | 66 | 67 | 68 | 69 | 70 | 71 | 72 | 73 | 74 | 75 | 76 | 77 | 78 | 79 | 80 | 81 | 82 | 83 | 84 | 85 | 86 | 87 | 88 | 89 | 90 | 91 | 92 | 93 | 94 | 95 | 96 | 97 | 98 | 99 | 100 | 101 | 102 | 103 | 104 | 105 | 106 | 107 | 108 | 109 | text/microsoft-resx 110 | 111 | 112 | 2.0 113 | 114 | 115 | System.Resources.ResXResourceReader, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089 116 | 117 | 118 | System.Resources.ResXResourceWriter, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089 119 | 120 | -------------------------------------------------------------------------------- /震动监测系统/FormUserManage.resx: -------------------------------------------------------------------------------- 1 | 2 | 3 | 62 | 63 | 64 | 65 | 66 | 67 | 68 | 69 | 70 | 71 | 72 | 73 | 74 | 75 | 76 | 77 | 78 | 79 | 80 | 81 | 82 | 83 | 84 | 85 | 86 | 87 | 88 | 89 | 90 | 91 | 92 | 93 | 94 | 95 | 96 | 97 | 98 | 99 | 100 | 101 | 102 | 103 | 104 | 105 | 106 | 107 | 108 | 109 | text/microsoft-resx 110 | 111 | 112 | 2.0 113 | 114 | 115 | System.Resources.ResXResourceReader, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089 116 | 117 | 118 | System.Resources.ResXResourceWriter, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089 119 | 120 | -------------------------------------------------------------------------------- /震动监测系统/Form_SP_Set.resx: -------------------------------------------------------------------------------- 1 | 2 | 3 | 62 | 63 | 64 | 65 | 66 | 67 | 68 | 69 | 70 | 71 | 72 | 73 | 74 | 75 | 76 | 77 | 78 | 79 | 80 | 81 | 82 | 83 | 84 | 85 | 86 | 87 | 88 | 89 | 90 | 91 | 92 | 93 | 94 | 95 | 96 | 97 | 98 | 99 | 100 | 101 | 102 | 103 | 104 | 105 | 106 | 107 | 108 | 109 | text/microsoft-resx 110 | 111 | 112 | 2.0 113 | 114 | 115 | System.Resources.ResXResourceReader, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089 116 | 117 | 118 | System.Resources.ResXResourceWriter, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089 119 | 120 | -------------------------------------------------------------------------------- /震动监测系统/Form_SP_Test.resx: -------------------------------------------------------------------------------- 1 | 2 | 3 | 62 | 63 | 64 | 65 | 66 | 67 | 68 | 69 | 70 | 71 | 72 | 73 | 74 | 75 | 76 | 77 | 78 | 79 | 80 | 81 | 82 | 83 | 84 | 85 | 86 | 87 | 88 | 89 | 90 | 91 | 92 | 93 | 94 | 95 | 96 | 97 | 98 | 99 | 100 | 101 | 102 | 103 | 104 | 105 | 106 | 107 | 108 | 109 | text/microsoft-resx 110 | 111 | 112 | 2.0 113 | 114 | 115 | System.Resources.ResXResourceReader, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089 116 | 117 | 118 | System.Resources.ResXResourceWriter, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089 119 | 120 | -------------------------------------------------------------------------------- /WindowsFormsControlLibrary1/Properties/Resources.resx: -------------------------------------------------------------------------------- 1 | 2 | 3 | 62 | 63 | 64 | 65 | 66 | 67 | 68 | 69 | 70 | 71 | 72 | 73 | 74 | 75 | 76 | 77 | 78 | 79 | 80 | 81 | 82 | 83 | 84 | 85 | 86 | 87 | 88 | 89 | 90 | 91 | 92 | 93 | 94 | 95 | 96 | 97 | 98 | 99 | 100 | 101 | 102 | 103 | 104 | 105 | 106 | 107 | 108 | 109 | text/microsoft-resx 110 | 111 | 112 | 2.0 113 | 114 | 115 | System.Resources.ResXResourceReader, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089 116 | 117 | 118 | System.Resources.ResXResourceWriter, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089 119 | 120 | -------------------------------------------------------------------------------- /震动监测系统/FormSignIn.resx: -------------------------------------------------------------------------------- 1 | 2 | 3 | 62 | 63 | 64 | 65 | 66 | 67 | 68 | 69 | 70 | 71 | 72 | 73 | 74 | 75 | 76 | 77 | 78 | 79 | 80 | 81 | 82 | 83 | 84 | 85 | 86 | 87 | 88 | 89 | 90 | 91 | 92 | 93 | 94 | 95 | 96 | 97 | 98 | 99 | 100 | 101 | 102 | 103 | 104 | 105 | 106 | 107 | 108 | 109 | text/microsoft-resx 110 | 111 | 112 | 2.0 113 | 114 | 115 | System.Resources.ResXResourceReader, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089 116 | 117 | 118 | System.Resources.ResXResourceWriter, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089 119 | 120 | 121 | True 122 | 123 | -------------------------------------------------------------------------------- /震动监测系统/FormWave.resx: -------------------------------------------------------------------------------- 1 | 2 | 3 | 62 | 63 | 64 | 65 | 66 | 67 | 68 | 69 | 70 | 71 | 72 | 73 | 74 | 75 | 76 | 77 | 78 | 79 | 80 | 81 | 82 | 83 | 84 | 85 | 86 | 87 | 88 | 89 | 90 | 91 | 92 | 93 | 94 | 95 | 96 | 97 | 98 | 99 | 100 | 101 | 102 | 103 | 104 | 105 | 106 | 107 | 108 | 109 | text/microsoft-resx 110 | 111 | 112 | 2.0 113 | 114 | 115 | System.Resources.ResXResourceReader, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089 116 | 117 | 118 | System.Resources.ResXResourceWriter, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089 119 | 120 | 121 | 17, 17 122 | 123 | -------------------------------------------------------------------------------- /震动监测系统/FormSignIn.Designer.cs: -------------------------------------------------------------------------------- 1 | namespace 震动监测系统 2 | { 3 | partial class FormSignIn 4 | { 5 | /// 6 | /// Required designer variable. 7 | /// 8 | private System.ComponentModel.IContainer components = null; 9 | 10 | /// 11 | /// Clean up any resources being used. 12 | /// 13 | /// true if managed resources should be disposed; otherwise, false. 14 | protected override void Dispose(bool disposing) 15 | { 16 | if (disposing && (components != null)) 17 | { 18 | components.Dispose(); 19 | } 20 | base.Dispose(disposing); 21 | } 22 | 23 | #region Windows Form Designer generated code 24 | 25 | /// 26 | /// Required method for Designer support - do not modify 27 | /// the contents of this method with the code editor. 28 | /// 29 | private void InitializeComponent() 30 | { 31 | this.btmSignIn = new System.Windows.Forms.Button(); 32 | this.lblAccount = new System.Windows.Forms.Label(); 33 | this.lblPassword = new System.Windows.Forms.Label(); 34 | this.txtbxPassword = new System.Windows.Forms.TextBox(); 35 | this.txtbxAccount = new System.Windows.Forms.TextBox(); 36 | this.SuspendLayout(); 37 | // 38 | // btmSignIn 39 | // 40 | this.btmSignIn.AutoSize = true; 41 | this.btmSignIn.Font = new System.Drawing.Font("宋体", 12F); 42 | this.btmSignIn.Location = new System.Drawing.Point(10, 62); 43 | this.btmSignIn.Margin = new System.Windows.Forms.Padding(4, 4, 4, 4); 44 | this.btmSignIn.Name = "btmSignIn"; 45 | this.btmSignIn.Size = new System.Drawing.Size(184, 26); 46 | this.btmSignIn.TabIndex = 2; 47 | this.btmSignIn.Text = "登录"; 48 | this.btmSignIn.UseVisualStyleBackColor = true; 49 | this.btmSignIn.Click += new System.EventHandler(this.btmSignIn_Click); 50 | // 51 | // lblAccount 52 | // 53 | this.lblAccount.AutoSize = true; 54 | this.lblAccount.BackColor = System.Drawing.SystemColors.Control; 55 | this.lblAccount.CausesValidation = false; 56 | this.lblAccount.Font = new System.Drawing.Font("宋体", 9F); 57 | this.lblAccount.Location = new System.Drawing.Point(10, 11); 58 | this.lblAccount.Margin = new System.Windows.Forms.Padding(4, 4, 4, 4); 59 | this.lblAccount.Name = "lblAccount"; 60 | this.lblAccount.Size = new System.Drawing.Size(41, 12); 61 | this.lblAccount.TabIndex = 1; 62 | this.lblAccount.Text = "账号:"; 63 | // 64 | // lblPassword 65 | // 66 | this.lblPassword.AutoSize = true; 67 | this.lblPassword.CausesValidation = false; 68 | this.lblPassword.Location = new System.Drawing.Point(10, 38); 69 | this.lblPassword.Margin = new System.Windows.Forms.Padding(4, 4, 4, 4); 70 | this.lblPassword.Name = "lblPassword"; 71 | this.lblPassword.Size = new System.Drawing.Size(41, 12); 72 | this.lblPassword.TabIndex = 2; 73 | this.lblPassword.Text = "密码:"; 74 | // 75 | // txtbxPassword 76 | // 77 | this.txtbxPassword.BorderStyle = System.Windows.Forms.BorderStyle.FixedSingle; 78 | this.txtbxPassword.Font = new System.Drawing.Font("宋体", 9F); 79 | this.txtbxPassword.Location = new System.Drawing.Point(45, 34); 80 | this.txtbxPassword.Margin = new System.Windows.Forms.Padding(4, 4, 4, 4); 81 | this.txtbxPassword.MaxLength = 16; 82 | this.txtbxPassword.Name = "txtbxPassword"; 83 | this.txtbxPassword.PasswordChar = '*'; 84 | this.txtbxPassword.Size = new System.Drawing.Size(150, 21); 85 | this.txtbxPassword.TabIndex = 1; 86 | this.txtbxPassword.UseSystemPasswordChar = true; 87 | this.txtbxPassword.WordWrap = false; 88 | this.txtbxPassword.KeyPress += new System.Windows.Forms.KeyPressEventHandler(this.txtbxPassword_KeyPress); 89 | // 90 | // txtbxAccount 91 | // 92 | this.txtbxAccount.Location = new System.Drawing.Point(45, 7); 93 | this.txtbxAccount.Margin = new System.Windows.Forms.Padding(2, 2, 2, 2); 94 | this.txtbxAccount.Name = "txtbxAccount"; 95 | this.txtbxAccount.Size = new System.Drawing.Size(151, 21); 96 | this.txtbxAccount.TabIndex = 0; 97 | this.txtbxAccount.KeyPress += new System.Windows.Forms.KeyPressEventHandler(this.txtbxAccount_KeyPress); 98 | // 99 | // FormSignIn 100 | // 101 | this.AutoScaleDimensions = new System.Drawing.SizeF(6F, 12F); 102 | this.AutoScaleMode = System.Windows.Forms.AutoScaleMode.Font; 103 | this.ClientSize = new System.Drawing.Size(206, 97); 104 | this.Controls.Add(this.txtbxAccount); 105 | this.Controls.Add(this.txtbxPassword); 106 | this.Controls.Add(this.lblPassword); 107 | this.Controls.Add(this.lblAccount); 108 | this.Controls.Add(this.btmSignIn); 109 | this.FormBorderStyle = System.Windows.Forms.FormBorderStyle.FixedSingle; 110 | this.Margin = new System.Windows.Forms.Padding(2, 2, 2, 2); 111 | this.MaximizeBox = false; 112 | this.Name = "FormSignIn"; 113 | this.ShowIcon = false; 114 | this.StartPosition = System.Windows.Forms.FormStartPosition.CenterScreen; 115 | this.Text = "系统登录"; 116 | this.TopMost = true; 117 | this.Shown += new System.EventHandler(this.FormSignIn_Shown); 118 | this.ResumeLayout(false); 119 | this.PerformLayout(); 120 | 121 | } 122 | 123 | #endregion 124 | 125 | private System.Windows.Forms.Button btmSignIn; 126 | private System.Windows.Forms.Label lblAccount; 127 | private System.Windows.Forms.Label lblPassword; 128 | private System.Windows.Forms.TextBox txtbxPassword; 129 | private System.Windows.Forms.TextBox txtbxAccount; 130 | } 131 | } -------------------------------------------------------------------------------- /震动监测系统/FormHistoryData.resx: -------------------------------------------------------------------------------- 1 | 2 | 3 | 62 | 63 | 64 | 65 | 66 | 67 | 68 | 69 | 70 | 71 | 72 | 73 | 74 | 75 | 76 | 77 | 78 | 79 | 80 | 81 | 82 | 83 | 84 | 85 | 86 | 87 | 88 | 89 | 90 | 91 | 92 | 93 | 94 | 95 | 96 | 97 | 98 | 99 | 100 | 101 | 102 | 103 | 104 | 105 | 106 | 107 | 108 | 109 | text/microsoft-resx 110 | 111 | 112 | 2.0 113 | 114 | 115 | System.Resources.ResXResourceReader, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089 116 | 117 | 118 | System.Resources.ResXResourceWriter, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089 119 | 120 | 121 | 189, 17 122 | 123 | 124 | 17, 17 125 | 126 | 127 | 17, 17 128 | 129 | -------------------------------------------------------------------------------- /.gitignore: -------------------------------------------------------------------------------- 1 | ## Ignore Visual Studio temporary files, build results, and 2 | ## files generated by popular Visual Studio add-ons. 3 | ## 4 | ## Get latest from https://github.com/github/gitignore/blob/master/VisualStudio.gitignore 5 | !/震动监测系统/bin/Debug/icon 6 | # User-specific files 7 | *.rsuser 8 | *.suo 9 | *.user 10 | *.userosscache 11 | *.sln.docstates 12 | 13 | # User-specific files (MonoDevelop/Xamarin Studio) 14 | *.userprefs 15 | 16 | # Build results 17 | [Dd]ebug/ 18 | [Dd]ebugPublic/ 19 | [Rr]elease/ 20 | [Rr]eleases/ 21 | x64/ 22 | x86/ 23 | [Aa][Rr][Mm]/ 24 | [Aa][Rr][Mm]64/ 25 | bld/ 26 | [Bb]in/ 27 | [Oo]bj/ 28 | [Ll]og/ 29 | 30 | # Visual Studio 2015/2017 cache/options directory 31 | .vs/ 32 | # Uncomment if you have tasks that create the project's static files in wwwroot 33 | #wwwroot/ 34 | 35 | # Visual Studio 2017 auto generated files 36 | Generated\ Files/ 37 | 38 | # MSTest test Results 39 | [Tt]est[Rr]esult*/ 40 | [Bb]uild[Ll]og.* 41 | 42 | # NUNIT 43 | *.VisualState.xml 44 | TestResult.xml 45 | 46 | # Build Results of an ATL Project 47 | [Dd]ebugPS/ 48 | [Rr]eleasePS/ 49 | dlldata.c 50 | 51 | # Benchmark Results 52 | BenchmarkDotNet.Artifacts/ 53 | 54 | # .NET Core 55 | project.lock.json 56 | project.fragment.lock.json 57 | artifacts/ 58 | 59 | # StyleCop 60 | StyleCopReport.xml 61 | 62 | # Files built by Visual Studio 63 | *_i.c 64 | *_p.c 65 | *_h.h 66 | *.ilk 67 | *.meta 68 | *.obj 69 | *.iobj 70 | *.pch 71 | *.pdb 72 | *.ipdb 73 | *.pgc 74 | *.pgd 75 | *.rsp 76 | *.sbr 77 | *.tlb 78 | *.tli 79 | *.tlh 80 | *.tmp 81 | *.tmp_proj 82 | *_wpftmp.csproj 83 | *.log 84 | *.vspscc 85 | *.vssscc 86 | .builds 87 | *.pidb 88 | *.svclog 89 | *.scc 90 | 91 | # Chutzpah Test files 92 | _Chutzpah* 93 | 94 | # Visual C++ cache files 95 | ipch/ 96 | *.aps 97 | *.ncb 98 | *.opendb 99 | *.opensdf 100 | *.sdf 101 | *.cachefile 102 | *.VC.db 103 | *.VC.VC.opendb 104 | 105 | # Visual Studio profiler 106 | *.psess 107 | *.vsp 108 | *.vspx 109 | *.sap 110 | 111 | # Visual Studio Trace Files 112 | *.e2e 113 | 114 | # TFS 2012 Local Workspace 115 | $tf/ 116 | 117 | # Guidance Automation Toolkit 118 | *.gpState 119 | 120 | # ReSharper is a .NET coding add-in 121 | _ReSharper*/ 122 | *.[Rr]e[Ss]harper 123 | *.DotSettings.user 124 | 125 | # JustCode is a .NET coding add-in 126 | .JustCode 127 | 128 | # TeamCity is a build add-in 129 | _TeamCity* 130 | 131 | # DotCover is a Code Coverage Tool 132 | *.dotCover 133 | 134 | # AxoCover is a Code Coverage Tool 135 | .axoCover/* 136 | !.axoCover/settings.json 137 | 138 | # Visual Studio code coverage results 139 | *.coverage 140 | *.coveragexml 141 | 142 | # NCrunch 143 | _NCrunch_* 144 | .*crunch*.local.xml 145 | nCrunchTemp_* 146 | 147 | # MightyMoose 148 | *.mm.* 149 | AutoTest.Net/ 150 | 151 | # Web workbench (sass) 152 | .sass-cache/ 153 | 154 | # Installshield output folder 155 | [Ee]xpress/ 156 | 157 | # DocProject is a documentation generator add-in 158 | DocProject/buildhelp/ 159 | DocProject/Help/*.HxT 160 | DocProject/Help/*.HxC 161 | DocProject/Help/*.hhc 162 | DocProject/Help/*.hhk 163 | DocProject/Help/*.hhp 164 | DocProject/Help/Html2 165 | DocProject/Help/html 166 | 167 | # Click-Once directory 168 | publish/ 169 | 170 | # Publish Web Output 171 | *.[Pp]ublish.xml 172 | *.azurePubxml 173 | # Note: Comment the next line if you want to checkin your web deploy settings, 174 | # but database connection strings (with potential passwords) will be unencrypted 175 | *.pubxml 176 | *.publishproj 177 | 178 | # Microsoft Azure Web App publish settings. Comment the next line if you want to 179 | # checkin your Azure Web App publish settings, but sensitive information contained 180 | # in these scripts will be unencrypted 181 | PublishScripts/ 182 | 183 | # NuGet Packages 184 | *.nupkg 185 | # The packages folder can be ignored because of Package Restore 186 | **/[Pp]ackages/* 187 | # except build/, which is used as an MSBuild target. 188 | !**/[Pp]ackages/build/ 189 | # Uncomment if necessary however generally it will be regenerated when needed 190 | #!**/[Pp]ackages/repositories.config 191 | # NuGet v3's project.json files produces more ignorable files 192 | *.nuget.props 193 | *.nuget.targets 194 | 195 | # Microsoft Azure Build Output 196 | csx/ 197 | *.build.csdef 198 | 199 | # Microsoft Azure Emulator 200 | ecf/ 201 | rcf/ 202 | 203 | # Windows Store app package directories and files 204 | AppPackages/ 205 | BundleArtifacts/ 206 | Package.StoreAssociation.xml 207 | _pkginfo.txt 208 | *.appx 209 | 210 | # Visual Studio cache files 211 | # files ending in .cache can be ignored 212 | *.[Cc]ache 213 | # but keep track of directories ending in .cache 214 | !?*.[Cc]ache/ 215 | 216 | # Others 217 | ClientBin/ 218 | ~$* 219 | *~ 220 | *.dbmdl 221 | *.dbproj.schemaview 222 | *.jfm 223 | *.pfx 224 | *.publishsettings 225 | orleans.codegen.cs 226 | 227 | # Including strong name files can present a security risk 228 | # (https://github.com/github/gitignore/pull/2483#issue-259490424) 229 | #*.snk 230 | 231 | # Since there are multiple workflows, uncomment next line to ignore bower_components 232 | # (https://github.com/github/gitignore/pull/1529#issuecomment-104372622) 233 | #bower_components/ 234 | 235 | # RIA/Silverlight projects 236 | Generated_Code/ 237 | 238 | # Backup & report files from converting an old project file 239 | # to a newer Visual Studio version. Backup files are not needed, 240 | # because we have git ;-) 241 | _UpgradeReport_Files/ 242 | Backup*/ 243 | UpgradeLog*.XML 244 | UpgradeLog*.htm 245 | ServiceFabricBackup/ 246 | *.rptproj.bak 247 | 248 | # SQL Server files 249 | *.mdf 250 | *.ldf 251 | *.ndf 252 | 253 | # Business Intelligence projects 254 | *.rdl.data 255 | *.bim.layout 256 | *.bim_*.settings 257 | *.rptproj.rsuser 258 | *- Backup*.rdl 259 | 260 | # Microsoft Fakes 261 | FakesAssemblies/ 262 | 263 | # GhostDoc plugin setting file 264 | *.GhostDoc.xml 265 | 266 | # Node.js Tools for Visual Studio 267 | .ntvs_analysis.dat 268 | node_modules/ 269 | 270 | # Visual Studio 6 build log 271 | *.plg 272 | 273 | # Visual Studio 6 workspace options file 274 | *.opt 275 | 276 | # Visual Studio 6 auto-generated workspace file (contains which files were open etc.) 277 | *.vbw 278 | 279 | # Visual Studio LightSwitch build output 280 | **/*.HTMLClient/GeneratedArtifacts 281 | **/*.DesktopClient/GeneratedArtifacts 282 | **/*.DesktopClient/ModelManifest.xml 283 | **/*.Server/GeneratedArtifacts 284 | **/*.Server/ModelManifest.xml 285 | _Pvt_Extensions 286 | 287 | # Paket dependency manager 288 | .paket/paket.exe 289 | paket-files/ 290 | 291 | # FAKE - F# Make 292 | .fake/ 293 | 294 | # JetBrains Rider 295 | .idea/ 296 | *.sln.iml 297 | 298 | # CodeRush personal settings 299 | .cr/personal 300 | 301 | # Python Tools for Visual Studio (PTVS) 302 | __pycache__/ 303 | *.pyc 304 | 305 | # Cake - Uncomment if you are using it 306 | # tools/** 307 | # !tools/packages.config 308 | 309 | # Tabs Studio 310 | *.tss 311 | 312 | # Telerik's JustMock configuration file 313 | *.jmconfig 314 | 315 | # BizTalk build output 316 | *.btp.cs 317 | *.btm.cs 318 | *.odx.cs 319 | *.xsd.cs 320 | 321 | # OpenCover UI analysis results 322 | OpenCover/ 323 | 324 | # Azure Stream Analytics local run output 325 | ASALocalRun/ 326 | 327 | # MSBuild Binary and Structured Log 328 | *.binlog 329 | 330 | # NVidia Nsight GPU debugger configuration file 331 | *.nvuser 332 | 333 | # MFractors (Xamarin productivity tool) working folder 334 | .mfractor/ 335 | 336 | # Local History for Visual Studio 337 | .localhistory/ 338 | 339 | # BeatPulse healthcheck temp database 340 | healthchecksdb -------------------------------------------------------------------------------- /震动监测系统/Form_SP_Test.Designer.cs: -------------------------------------------------------------------------------- 1 | namespace 震动监测系统 2 | { 3 | partial class Form_SP_Test 4 | { 5 | /// 6 | /// Required designer variable. 7 | /// 8 | private System.ComponentModel.IContainer components = null; 9 | 10 | /// 11 | /// Clean up any resources being used. 12 | /// 13 | /// true if managed resources should be disposed; otherwise, false. 14 | protected override void Dispose(bool disposing) 15 | { 16 | if (disposing && (components != null)) 17 | { 18 | components.Dispose(); 19 | } 20 | base.Dispose(disposing); 21 | } 22 | 23 | #region Windows Form Designer generated code 24 | 25 | /// 26 | /// Required method for Designer support - do not modify 27 | /// the contents of this method with the code editor. 28 | /// 29 | private void InitializeComponent() 30 | { 31 | this.boxtest_result = new System.Windows.Forms.TextBox(); 32 | this.button_sp_tests_start = new System.Windows.Forms.Button(); 33 | this.boxtest_com_num = new System.Windows.Forms.TextBox(); 34 | this.labtest_com_num = new System.Windows.Forms.Label(); 35 | this.label1 = new System.Windows.Forms.Label(); 36 | this.boxtest_bode_num = new System.Windows.Forms.TextBox(); 37 | this.button_sp_test_close = new System.Windows.Forms.Button(); 38 | this.SuspendLayout(); 39 | // 40 | // boxtest_result 41 | // 42 | this.boxtest_result.Anchor = System.Windows.Forms.AnchorStyles.Bottom; 43 | this.boxtest_result.Location = new System.Drawing.Point(18, 103); 44 | this.boxtest_result.Margin = new System.Windows.Forms.Padding(11, 12, 11, 12); 45 | this.boxtest_result.Multiline = true; 46 | this.boxtest_result.Name = "boxtest_result"; 47 | this.boxtest_result.ReadOnly = true; 48 | this.boxtest_result.ScrollBars = System.Windows.Forms.ScrollBars.Vertical; 49 | this.boxtest_result.Size = new System.Drawing.Size(364, 161); 50 | this.boxtest_result.TabIndex = 0; 51 | this.boxtest_result.TabStop = false; 52 | // 53 | // button_sp_tests_start 54 | // 55 | this.button_sp_tests_start.Location = new System.Drawing.Point(194, 26); 56 | this.button_sp_tests_start.Margin = new System.Windows.Forms.Padding(2, 2, 2, 2); 57 | this.button_sp_tests_start.Name = "button_sp_tests_start"; 58 | this.button_sp_tests_start.Size = new System.Drawing.Size(75, 45); 59 | this.button_sp_tests_start.TabIndex = 1; 60 | this.button_sp_tests_start.Text = "开始测试"; 61 | this.button_sp_tests_start.UseVisualStyleBackColor = true; 62 | this.button_sp_tests_start.Click += new System.EventHandler(this.Button_sp_test_Click); 63 | // 64 | // boxtest_com_num 65 | // 66 | this.boxtest_com_num.Location = new System.Drawing.Point(82, 23); 67 | this.boxtest_com_num.Margin = new System.Windows.Forms.Padding(2, 2, 2, 2); 68 | this.boxtest_com_num.Name = "boxtest_com_num"; 69 | this.boxtest_com_num.ReadOnly = true; 70 | this.boxtest_com_num.Size = new System.Drawing.Size(58, 21); 71 | this.boxtest_com_num.TabIndex = 2; 72 | // 73 | // labtest_com_num 74 | // 75 | this.labtest_com_num.AutoSize = true; 76 | this.labtest_com_num.Location = new System.Drawing.Point(28, 26); 77 | this.labtest_com_num.Margin = new System.Windows.Forms.Padding(2, 0, 2, 0); 78 | this.labtest_com_num.Name = "labtest_com_num"; 79 | this.labtest_com_num.Size = new System.Drawing.Size(53, 12); 80 | this.labtest_com_num.TabIndex = 3; 81 | this.labtest_com_num.Text = "端口号:"; 82 | // 83 | // label1 84 | // 85 | this.label1.AutoSize = true; 86 | this.label1.Location = new System.Drawing.Point(28, 58); 87 | this.label1.Margin = new System.Windows.Forms.Padding(2, 0, 2, 0); 88 | this.label1.Name = "label1"; 89 | this.label1.Size = new System.Drawing.Size(53, 12); 90 | this.label1.TabIndex = 4; 91 | this.label1.Text = "波特率:"; 92 | // 93 | // boxtest_bode_num 94 | // 95 | this.boxtest_bode_num.Location = new System.Drawing.Point(82, 56); 96 | this.boxtest_bode_num.Margin = new System.Windows.Forms.Padding(2, 2, 2, 2); 97 | this.boxtest_bode_num.Name = "boxtest_bode_num"; 98 | this.boxtest_bode_num.ReadOnly = true; 99 | this.boxtest_bode_num.Size = new System.Drawing.Size(58, 21); 100 | this.boxtest_bode_num.TabIndex = 5; 101 | // 102 | // button_sp_test_close 103 | // 104 | this.button_sp_test_close.Location = new System.Drawing.Point(288, 26); 105 | this.button_sp_test_close.Margin = new System.Windows.Forms.Padding(2, 2, 2, 2); 106 | this.button_sp_test_close.Name = "button_sp_test_close"; 107 | this.button_sp_test_close.Size = new System.Drawing.Size(75, 45); 108 | this.button_sp_test_close.TabIndex = 6; 109 | this.button_sp_test_close.Text = "停止测试"; 110 | this.button_sp_test_close.UseVisualStyleBackColor = true; 111 | this.button_sp_test_close.Click += new System.EventHandler(this.button_sp_test_close_Click); 112 | // 113 | // Form_SP_Test 114 | // 115 | this.AutoScaleDimensions = new System.Drawing.SizeF(6F, 12F); 116 | this.AutoScaleMode = System.Windows.Forms.AutoScaleMode.Font; 117 | this.ClientSize = new System.Drawing.Size(399, 282); 118 | this.Controls.Add(this.button_sp_test_close); 119 | this.Controls.Add(this.boxtest_bode_num); 120 | this.Controls.Add(this.label1); 121 | this.Controls.Add(this.labtest_com_num); 122 | this.Controls.Add(this.boxtest_com_num); 123 | this.Controls.Add(this.button_sp_tests_start); 124 | this.Controls.Add(this.boxtest_result); 125 | this.FormBorderStyle = System.Windows.Forms.FormBorderStyle.FixedSingle; 126 | this.Margin = new System.Windows.Forms.Padding(2, 2, 2, 2); 127 | this.Name = "Form_SP_Test"; 128 | this.StartPosition = System.Windows.Forms.FormStartPosition.CenterParent; 129 | this.Text = "连接测试"; 130 | this.FormClosing += new System.Windows.Forms.FormClosingEventHandler(this.Form_SP_Test_FormClosing); 131 | this.Shown += new System.EventHandler(this.Form_SP_Test_Shown); 132 | this.ResumeLayout(false); 133 | this.PerformLayout(); 134 | 135 | } 136 | 137 | #endregion 138 | 139 | private System.Windows.Forms.TextBox boxtest_result; 140 | private System.Windows.Forms.Button button_sp_tests_start; 141 | private System.Windows.Forms.TextBox boxtest_com_num; 142 | private System.Windows.Forms.Label labtest_com_num; 143 | private System.Windows.Forms.Label label1; 144 | private System.Windows.Forms.TextBox boxtest_bode_num; 145 | private System.Windows.Forms.Button button_sp_test_close; 146 | } 147 | } -------------------------------------------------------------------------------- /震动监测系统/Form_SP_Set.Designer.cs: -------------------------------------------------------------------------------- 1 | namespace 震动监测系统 2 | { 3 | partial class Form_SP_Set 4 | { 5 | /// 6 | /// Required designer variable. 7 | /// 8 | private System.ComponentModel.IContainer components = null; 9 | 10 | /// 11 | /// Clean up any resources being used. 12 | /// 13 | /// true if managed resources should be disposed; otherwise, false. 14 | protected override void Dispose(bool disposing) 15 | { 16 | if (disposing && (components != null)) 17 | { 18 | components.Dispose(); 19 | } 20 | base.Dispose(disposing); 21 | } 22 | 23 | #region Windows Form Designer generated code 24 | 25 | /// 26 | /// Required method for Designer support - do not modify 27 | /// the contents of this method with the code editor. 28 | /// 29 | private void InitializeComponent() 30 | { 31 | this.com_num = new System.Windows.Forms.Label(); 32 | this.com_list = new System.Windows.Forms.ComboBox(); 33 | this.bode_num = new System.Windows.Forms.Label(); 34 | this.bode_list = new System.Windows.Forms.ComboBox(); 35 | this.data_num = new System.Windows.Forms.Label(); 36 | this.stop_num = new System.Windows.Forms.Label(); 37 | this.data_box = new System.Windows.Forms.TextBox(); 38 | this.stop_box = new System.Windows.Forms.TextBox(); 39 | this.opencom_button = new System.Windows.Forms.Button(); 40 | this.SuspendLayout(); 41 | // 42 | // com_num 43 | // 44 | this.com_num.AutoSize = true; 45 | this.com_num.Font = new System.Drawing.Font("宋体", 10F); 46 | this.com_num.Location = new System.Drawing.Point(40, 40); 47 | this.com_num.Name = "com_num"; 48 | this.com_num.Size = new System.Drawing.Size(76, 17); 49 | this.com_num.TabIndex = 0; 50 | this.com_num.Text = "端口号:"; 51 | // 52 | // com_list 53 | // 54 | this.com_list.DropDownStyle = System.Windows.Forms.ComboBoxStyle.DropDownList; 55 | this.com_list.FormattingEnabled = true; 56 | this.com_list.Location = new System.Drawing.Point(120, 36); 57 | this.com_list.Name = "com_list"; 58 | this.com_list.Size = new System.Drawing.Size(100, 23); 59 | this.com_list.TabIndex = 1; 60 | // 61 | // bode_num 62 | // 63 | this.bode_num.AutoSize = true; 64 | this.bode_num.Font = new System.Drawing.Font("宋体", 10F); 65 | this.bode_num.Location = new System.Drawing.Point(40, 80); 66 | this.bode_num.Name = "bode_num"; 67 | this.bode_num.Size = new System.Drawing.Size(76, 17); 68 | this.bode_num.TabIndex = 2; 69 | this.bode_num.Text = "波特率:"; 70 | // 71 | // bode_list 72 | // 73 | this.bode_list.FormattingEnabled = true; 74 | this.bode_list.Location = new System.Drawing.Point(120, 76); 75 | this.bode_list.Name = "bode_list"; 76 | this.bode_list.Size = new System.Drawing.Size(100, 23); 77 | this.bode_list.TabIndex = 2; 78 | this.bode_list.Text = "2400"; 79 | // 80 | // data_num 81 | // 82 | this.data_num.AutoSize = true; 83 | this.data_num.Font = new System.Drawing.Font("宋体", 10F); 84 | this.data_num.Location = new System.Drawing.Point(40, 120); 85 | this.data_num.Name = "data_num"; 86 | this.data_num.Size = new System.Drawing.Size(76, 17); 87 | this.data_num.TabIndex = 4; 88 | this.data_num.Text = "数据位:"; 89 | // 90 | // stop_num 91 | // 92 | this.stop_num.AutoSize = true; 93 | this.stop_num.Font = new System.Drawing.Font("宋体", 10F); 94 | this.stop_num.Location = new System.Drawing.Point(40, 160); 95 | this.stop_num.Name = "stop_num"; 96 | this.stop_num.Size = new System.Drawing.Size(76, 17); 97 | this.stop_num.TabIndex = 6; 98 | this.stop_num.Text = "停止位:"; 99 | // 100 | // data_box 101 | // 102 | this.data_box.Location = new System.Drawing.Point(120, 116); 103 | this.data_box.MaxLength = 2; 104 | this.data_box.Name = "data_box"; 105 | this.data_box.Size = new System.Drawing.Size(100, 25); 106 | this.data_box.TabIndex = 3; 107 | this.data_box.Text = "8"; 108 | this.data_box.TextAlign = System.Windows.Forms.HorizontalAlignment.Right; 109 | // 110 | // stop_box 111 | // 112 | this.stop_box.Location = new System.Drawing.Point(120, 156); 113 | this.stop_box.MaxLength = 1; 114 | this.stop_box.Name = "stop_box"; 115 | this.stop_box.Size = new System.Drawing.Size(100, 25); 116 | this.stop_box.TabIndex = 4; 117 | this.stop_box.Text = "1"; 118 | this.stop_box.TextAlign = System.Windows.Forms.HorizontalAlignment.Right; 119 | // 120 | // opencom_button 121 | // 122 | this.opencom_button.Location = new System.Drawing.Point(43, 204); 123 | this.opencom_button.Name = "opencom_button"; 124 | this.opencom_button.Size = new System.Drawing.Size(177, 50); 125 | this.opencom_button.TabIndex = 5; 126 | this.opencom_button.Text = "打开端口"; 127 | this.opencom_button.UseVisualStyleBackColor = true; 128 | this.opencom_button.Click += new System.EventHandler(this.Opencom_button_Click); 129 | // 130 | // Form_SP_Set 131 | // 132 | this.AutoScaleDimensions = new System.Drawing.SizeF(8F, 15F); 133 | this.AutoScaleMode = System.Windows.Forms.AutoScaleMode.Font; 134 | this.ClientSize = new System.Drawing.Size(260, 293); 135 | this.Controls.Add(this.opencom_button); 136 | this.Controls.Add(this.stop_box); 137 | this.Controls.Add(this.data_box); 138 | this.Controls.Add(this.stop_num); 139 | this.Controls.Add(this.data_num); 140 | this.Controls.Add(this.bode_list); 141 | this.Controls.Add(this.bode_num); 142 | this.Controls.Add(this.com_list); 143 | this.Controls.Add(this.com_num); 144 | this.FormBorderStyle = System.Windows.Forms.FormBorderStyle.FixedSingle; 145 | this.MaximizeBox = false; 146 | this.MinimizeBox = false; 147 | this.Name = "Form_SP_Set"; 148 | this.ShowIcon = false; 149 | this.StartPosition = System.Windows.Forms.FormStartPosition.CenterParent; 150 | this.Text = "串口设置"; 151 | this.Shown += new System.EventHandler(this.Form_SP_Set_Shown); 152 | this.ResumeLayout(false); 153 | this.PerformLayout(); 154 | 155 | } 156 | 157 | #endregion 158 | 159 | private System.Windows.Forms.Label com_num; 160 | private System.Windows.Forms.ComboBox com_list; 161 | private System.Windows.Forms.Label bode_num; 162 | private System.Windows.Forms.ComboBox bode_list; 163 | private System.Windows.Forms.Label data_num; 164 | private System.Windows.Forms.Label stop_num; 165 | private System.Windows.Forms.TextBox data_box; 166 | private System.Windows.Forms.TextBox stop_box; 167 | private System.Windows.Forms.Button opencom_button; 168 | } 169 | } -------------------------------------------------------------------------------- /WindowsFormsControlLibrary1/MyButton.resx: -------------------------------------------------------------------------------- 1 | 2 | 3 | 62 | 63 | 64 | 65 | 66 | 67 | 68 | 69 | 70 | 71 | 72 | 73 | 74 | 75 | 76 | 77 | 78 | 79 | 80 | 81 | 82 | 83 | 84 | 85 | 86 | 87 | 88 | 89 | 90 | 91 | 92 | 93 | 94 | 95 | 96 | 97 | 98 | 99 | 100 | 101 | 102 | 103 | 104 | 105 | 106 | 107 | 108 | 109 | text/microsoft-resx 110 | 111 | 112 | 2.0 113 | 114 | 115 | System.Resources.ResXResourceReader, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089 116 | 117 | 118 | System.Resources.ResXResourceWriter, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089 119 | 120 | 121 | 122 | 123 | iVBORw0KGgoAAAANSUhEUgAAAMgAAADICAYAAACtWK6eAAAABGdBTUEAALGPC/xhBQAABXBJREFUeF7t 124 | 3V3ov/ccx/G/UO6ahKLVUlJsKTfJalZDyF2RLJG7mq1Wy2ISBzbWopBlLYncHTiYLbYD9yUHNpkT/CO1 125 | aLQ4IbdxQLw+ZrWtT/9+///v+/5+r/d1PR71PNnhdX1etf/vd/2u6wQAAAAAAAAAAAAAAAAAAAAAAAAA 126 | AACVHpPekC5Pzx7/AbjXM9IP0n/+39/T1Qk276npJ+m+cdy/dyXYrHPSnWk2jvu6JMHmPCndnmajeHAX 127 | J9iMx6fvp9kYZv0rvTzB6p2VvpNmQzhVf0wXJFitR6avp9kAjtLd6ZkJVudh6WtpdvBPp5+lpyRYla+k 128 | 2YE/k8bvTMa/Y2AVvpxmB/04fTM9PEFrX0izA76LbkrQ1mfS7GDvss8maOfGNDvQFX0iQRvXp9lBruyD 129 | CRbvo2l2gPfRuxMs1nVpdnD32aUJFueaNDuwh2j84RUsxvvT7KAeqn+nVyQ4uPek2SE9dH9KFyY4mCvT 130 | 7HAupd+kZyXYu/FyhdmhXFon0/izXtibd6TZYVxqd6QnJij31jQ7hEvvW+kRCcq8Mc0OX5fGI/dQ4vVp 131 | dui69bkEO/WaNH63MDtwHRvPisFOvDL9I80OWuc+lOBYXpr+kmYHbA2NX3LCGXlh+kOaHaw1dVmC0/KC 132 | 9Ls0O1BrbPx0Do7k+Wk8ojE7SGvu1QlO6TnprjQ7QGvvz+miBFPjjYW/SLPDs5V+m56b4AGenn6aZodm 133 | a/08PS3B/4wnXX+cZodlq/0wjc8zsHHjAzbjSdfZIdl6306PTmzUk9PpfKNji92S2KAnpO+m2aHQA/t8 134 | YkMem76RZodB8z6Z2IBHpVvT7BDo1I13frFi41MBN6fZzdfRem9ipSq+0bHFxssqWJkvptnN1pn15sRK 135 | jO9nzG6yjtf4K0ua+1Sa3Vwdv7+mFyeaGj+anN1Y7a570vMSzXw8zW6odt94Ano87EkTH0mzG6m6fpTO 136 | TizctWl2A1XfeHTnrMRCfSDNbpz211fTQxIL8740u2Haf19KLMhVaXajdLjGJ7BZgHem2Q3S4ftw4oC6 137 | fMBmy41vN3IA3T5gs+WuSOzR29LsRmi5jXvGHrwpzW6Alt/rEoUuTmv6RsfW+lt6SaLAa9M/0+zCq0/j 138 | heDnJ3boVWk8Wj274OrXL9N5iR14WdrCNzq21niT5XhpH8fwovT7NLvA6t/30uMSZ+DCNN40PruwWk+3 139 | pYcmTsP4gM2v0uyCan19LHFE4wM24x9xswupdTb+V4sjGB+wGRdL22n8/ci5CQAAAADYrLen8RaNX6fZ 140 | z9i1vC5K7MFNaXYDtOwMZA9uSLOLr+VnIMXekmYXXj0ykGIn0+zCq0cGUmh8/H920dUnAyk0Lu7soqtP 141 | BlLIQPpnIIUMpH8GUshA+mcghQykfwZSyED6ZyCFDKR/BlLIQPpnIIUMpH8GUshA+mcghQykfwZSyED6 142 | ZyCFDKR/BlLIQPpnIIUMpH8GUshA+mcghQykfwZSyED6ZyCFDKR/BlLIQPpnIIUMpH8GUshA+mcghQyk 143 | fwZSyED6ZyCFDKR/BlLIQPpnIIUMpH8GUshA+mcghQykfwZSyED6ZyCFDKR/BlLIQPpnIIUMpH8GUshA 144 | +mcghQykfwZSyED6ZyCFDKR/BlLIQPpnIIUMpH8GUshA+mcghQykfwZSyED6ZyCFDKR/BlLIQPpnIIUM 145 | pH8GUshA+mcghQykfwZSyED6ZyCFDKR/BlLIQPpnIIUMpH8GUshA+mcghQykfwZSyED6ZyCFDKR/ZyeK 146 | GEjv7koUMpDefTpRyEB6RzED6dnJdG6imIH06Z50W7omAQAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAADA 147 | Tpw48V+VcacLnhdcrQAAAABJRU5ErkJggg== 148 | 149 | 150 | -------------------------------------------------------------------------------- /震动监测系统/FormHistoryData.cs: -------------------------------------------------------------------------------- 1 | using System; 2 | using System.Collections.Generic; 3 | using System.ComponentModel; 4 | using System.Data; 5 | using System.Data.Common; 6 | using System.Drawing; 7 | using System.Linq; 8 | using System.Text; 9 | using System.Threading.Tasks; 10 | using System.Windows.Forms; 11 | 12 | namespace 震动监测系统 13 | { 14 | public partial class FormHistoryData : Form 15 | { 16 | DataSet ds = new DataSet(); 17 | //CTMySql cm = new CTMySql("localhost", "root", "震动监测系统", "000000", "3306"); 18 | CTMySql cm = new CTMySql(); 19 | 20 | static int[] timgap = { 0, 1, 5, 10, 25, 50, 100, 250, 500 }; 21 | static string[] timlable = { "0", "2ms", "10ms", "20ms", "50ms", "100ms", "200ms", "500ms", "1000ms" }; 22 | string tablename1 = ""; 23 | string tablename2 = ""; 24 | 25 | public FormHistoryData() 26 | { 27 | InitializeComponent(); 28 | InitListbox(); 29 | } 30 | 31 | void InitListbox() 32 | { 33 | listBox1.Items.Clear(); 34 | listBox2.Items.Clear(); 35 | List s; 36 | s = cm.GetAllDatatableName(); 37 | for(int i = 0; i < s.Count - 1; i++) 38 | { 39 | this.listBox1.Items.Add(s[i]); 40 | this.listBox2.Items.Add(s[i]); 41 | } 42 | 43 | hScrollBar1.Enabled = false; // init disable hSrollBar 44 | hScrollBar2.Enabled = false; // init disable hSrollBar 45 | wave1_timegap_TrackBar.Enabled = false; 46 | wave2_timegap_TrackBar.Enabled = false; 47 | } 48 | 49 | // select data point and draw wave 50 | void SelectShowData(string tablename, ref PictureBox pictureBox, ref HScrollBar hScrollBar, ref TrackBar trackBar) 51 | { 52 | DrawWave dw = new DrawWave(ref pictureBox); 53 | 54 | ushort[] data; 55 | int gap; //x axis timegap 56 | int datanum = (dw.boxSize.X - 40) / 5; 57 | gap = timgap[trackBar.Value]; 58 | data = new ushort[datanum]; 59 | 60 | // set hScrollBar 61 | hScrollBar.LargeChange = 50 * gap; 62 | hScrollBar.SmallChange = 5 * gap; 63 | hScrollBar.Maximum = ds.Tables[tablename].Rows.Count - (datanum + 1) * gap; 64 | hScrollBar.Minimum = 0; 65 | if (hScrollBar.Maximum < 0) hScrollBar.Maximum = 0; 66 | 67 | for(int i = 0; i < datanum; i++) 68 | { 69 | try 70 | { 71 | data[i] = (ushort)ds.Tables[tablename].Rows[i * gap + hScrollBar.Value][2]; 72 | } 73 | catch (Exception) 74 | { 75 | break; 76 | } 77 | } 78 | 79 | dw.ClearToBackcolor(ref pictureBox); 80 | dw.DrawXaxis(ref pictureBox, 1, 5); 81 | dw.DrawYaxis(ref pictureBox, 1, 5); 82 | dw.Wave(ref data, ref pictureBox, 1, 1); 83 | } 84 | 85 | //波形1显示按钮 点击 86 | private void WaveShow1Button_Click(object sender, EventArgs e) 87 | { 88 | if (pictureBox1.Enabled == false && pictureBox1.Visible == false) 89 | { 90 | pictureBox1.Enabled = true; 91 | pictureBox1.Visible = true; 92 | hScrollBar1.Enabled = true; 93 | } 94 | if (dataGridView1.Enabled == true && dataGridView1.Visible == true) 95 | { 96 | dataGridView1.Visible = false; 97 | dataGridView1.Enabled = false; 98 | } 99 | if (listBox1.SelectedIndex < 0) 100 | { 101 | MessageBox.Show("请选择需显示的数据", "请选择数据", MessageBoxButtons.OK); 102 | return; 103 | } 104 | 105 | tablename1 = listBox1.SelectedItem.ToString(); 106 | 107 | try 108 | { 109 | ds.Tables.Add(cm.GetTableValue(tablename1)); 110 | } 111 | catch (Exception) { } 112 | 113 | SelectShowData(tablename1, ref pictureBox1, ref hScrollBar1, ref wave1_timegap_TrackBar); 114 | 115 | hScrollBar1.Value = 0; 116 | hScrollBar1.Enabled = true; 117 | wave1_timegap_TrackBar.Enabled = true; 118 | } 119 | 120 | //波形2显示按钮 点击 121 | private void WaveShow2Button_Click(object sender, EventArgs e) 122 | { 123 | if (pictureBox2.Enabled == false && pictureBox2.Visible == false) 124 | { 125 | pictureBox2.Enabled = true; 126 | pictureBox2.Visible = true; 127 | hScrollBar2.Enabled = true; 128 | } 129 | if (dataGridView2.Enabled == true && dataGridView2.Visible == true) 130 | { 131 | dataGridView2.Visible = false; 132 | dataGridView2.Enabled = false; 133 | } 134 | if (listBox2.SelectedIndex < 0) 135 | { 136 | MessageBox.Show("请选择需显示的数据", "请选择数据", MessageBoxButtons.OK); 137 | return; 138 | } 139 | 140 | tablename2 = listBox2.SelectedItem.ToString(); 141 | 142 | try 143 | { 144 | ds.Tables.Add(cm.GetTableValue(tablename2)); 145 | } 146 | catch (Exception) { } 147 | 148 | SelectShowData(tablename2, ref pictureBox2, ref hScrollBar2, ref wave2_timegap_TrackBar); 149 | 150 | hScrollBar2.Value = 0; 151 | hScrollBar2.Enabled = true; 152 | wave2_timegap_TrackBar.Enabled = true; 153 | } 154 | 155 | // hScrollBar1 value changed 156 | private void hScrollBar1_ValueChanged(object sender, EventArgs e) 157 | { 158 | SelectShowData(tablename1, ref pictureBox1, ref hScrollBar1, ref wave1_timegap_TrackBar); 159 | } 160 | 161 | // trackBar1 value changed 162 | private void wave1_timegap_TrackBar_ValueChanged(object sender, EventArgs e) 163 | { 164 | wave1_timeshow_label.Text = timlable[wave1_timegap_TrackBar.Value]; 165 | SelectShowData(tablename1, ref pictureBox1, ref hScrollBar1, ref wave1_timegap_TrackBar); 166 | } 167 | 168 | private void hScrollBar2_ValueChanged(object sender, EventArgs e) 169 | { 170 | SelectShowData(tablename2, ref pictureBox2, ref hScrollBar2, ref wave2_timegap_TrackBar); 171 | } 172 | 173 | private void wave2_timegap_TrackBar_ValueChanged(object sender, EventArgs e) 174 | { 175 | wave2_timeshow_label.Text = timlable[wave2_timegap_TrackBar.Value]; 176 | SelectShowData(tablename2, ref pictureBox2, ref hScrollBar2, ref wave2_timegap_TrackBar); 177 | } 178 | 179 | // dataGridView Init 180 | void InitDataGridView(DataGridView dg, string tn) 181 | { 182 | dg.DataSource = ds.Tables[tn]; 183 | 184 | dg.AllowDrop = false; 185 | dg.AllowUserToAddRows = false; 186 | dg.AllowUserToDeleteRows = false; 187 | dg.ReadOnly = true; 188 | dg.AutoSizeColumnsMode = DataGridViewAutoSizeColumnsMode.AllCells; 189 | } 190 | 191 | private void ListShow1Button_Click(object sender, EventArgs e) 192 | { 193 | if (pictureBox1.Enabled == true && pictureBox1.Visible == true) 194 | { 195 | pictureBox1.Visible = false; 196 | pictureBox1.Enabled = false; 197 | hScrollBar1.Enabled = false; 198 | } 199 | if (dataGridView1.Enabled == false && dataGridView1.Visible == false) 200 | { 201 | dataGridView1.Visible = true; 202 | dataGridView1.Enabled = true; 203 | } 204 | 205 | if (listBox1.SelectedIndex < 0) 206 | { 207 | MessageBox.Show("请选择需显示的数据", "请选择数据", MessageBoxButtons.OK); 208 | return; 209 | } 210 | 211 | tablename1 = listBox1.SelectedItem.ToString(); 212 | 213 | try 214 | { 215 | ds.Tables.Add(cm.GetTableValue(tablename1)); 216 | } 217 | catch (Exception) { } 218 | 219 | InitDataGridView(dataGridView1, tablename1); 220 | } 221 | 222 | private void ListShow2Button_Click(object sender, EventArgs e) 223 | { 224 | if (pictureBox2.Enabled == true && pictureBox2.Visible == true) 225 | { 226 | pictureBox2.Visible = false; 227 | pictureBox2.Enabled = false; 228 | hScrollBar2.Enabled = false; 229 | } 230 | if (dataGridView2.Enabled == false && dataGridView2.Visible == false) 231 | { 232 | dataGridView2.Visible = true; 233 | dataGridView2.Enabled = true; 234 | } 235 | 236 | if (listBox2.SelectedIndex < 0) 237 | { 238 | MessageBox.Show("请选择需显示的数据", "请选择数据", MessageBoxButtons.OK); 239 | return; 240 | } 241 | 242 | tablename2 = listBox2.SelectedItem.ToString(); 243 | 244 | try 245 | { 246 | ds.Tables.Add(cm.GetTableValue(tablename2)); 247 | } 248 | catch (Exception) { } 249 | 250 | InitDataGridView(dataGridView2, tablename2); 251 | } 252 | } 253 | } 254 | -------------------------------------------------------------------------------- /数据模拟发送/Form1.cs: -------------------------------------------------------------------------------- 1 | using System; 2 | using System.Collections.Generic; 3 | using System.ComponentModel; 4 | using System.Data; 5 | using System.Drawing; 6 | using System.Linq; 7 | using System.Text; 8 | using System.Threading.Tasks; 9 | using System.Windows.Forms; 10 | using System.Threading; 11 | using System.IO.Pipes; 12 | 13 | namespace 数据模拟发送 14 | { 15 | public partial class MainForm : Form 16 | { 17 | static bool openThreadFlag = false; 18 | static bool raFlag = false; 19 | static int rangflag = 0; 20 | static bool sendFlag = false; 21 | static bool readbstopflag = false; 22 | static bool readastopflag = false; 23 | 24 | public MainForm() 25 | { 26 | InitializeComponent(); 27 | } 28 | 29 | private void MainForm_Load(object sender, EventArgs e) 30 | { 31 | Console.WriteLine("1111111111111111"); 32 | Control.CheckForIllegalCrossThreadCalls = false; 33 | if (controlconfig.existItem("porttxt") 34 | && controlconfig.existItem("bodetxt") 35 | && controlconfig.existItem("datatxt") 36 | && controlconfig.existItem("stoptxt") 37 | && controlconfig.existItem("range1txt") 38 | && controlconfig.existItem("mid1txt") 39 | && controlconfig.existItem("range2txt") 40 | && controlconfig.existItem("mid2txt") 41 | && controlconfig.existItem("lineValtxt") 42 | && controlconfig.existItem("timetxt")) 43 | { 44 | porttxt.Text = controlconfig.valueItem("porttxt"); 45 | bodetxt.Text = controlconfig.valueItem("bodetxt"); 46 | datatxt.Text = controlconfig.valueItem("datatxt"); 47 | stoptxt.Text = controlconfig.valueItem("stoptxt"); 48 | range1txt.Text = controlconfig.valueItem("range1txt"); 49 | mid1txt.Text = controlconfig.valueItem("mid1txt"); 50 | range2txt.Text = controlconfig.valueItem("range2txt"); 51 | mid2txt.Text = controlconfig.valueItem("mid2txt"); 52 | lineValtxt.Text = controlconfig.valueItem("lineValtxt"); 53 | timetxt.Text = controlconfig.valueItem("timetxt"); 54 | } 55 | else 56 | { 57 | porttxt.Text = "COM5"; 58 | bodetxt.Text = "115200"; 59 | datatxt.Text = "8"; 60 | stoptxt.Text = "1"; 61 | range1txt.Text = "10000"; 62 | mid1txt.Text = "30000"; 63 | range2txt.Text = "1000"; 64 | mid2txt.Text = "30000"; 65 | lineValtxt.Text = "30000"; 66 | timetxt.Text = "1000"; 67 | } 68 | button1.Focus(); 69 | } 70 | 71 | public void NTextChanged(TextBox txt) 72 | { 73 | controlconfig.AddOrModifyItem(txt.Name, txt.Text); 74 | } 75 | 76 | private void porttxt_TextChanged(object sender, EventArgs e) 77 | { 78 | NTextChanged(porttxt); 79 | } 80 | 81 | private void bodetxt_TextChanged(object sender, EventArgs e) 82 | { 83 | NTextChanged(bodetxt); 84 | } 85 | 86 | private void datatxt_TextChanged(object sender, EventArgs e) 87 | { 88 | NTextChanged(datatxt); 89 | } 90 | 91 | private void stoptxt_TextChanged(object sender, EventArgs e) 92 | { 93 | NTextChanged(stoptxt); 94 | } 95 | 96 | private void range1txt_TextChanged(object sender, EventArgs e) 97 | { 98 | NTextChanged(range1txt); 99 | } 100 | 101 | private void mid1txt_TextChanged(object sender, EventArgs e) 102 | { 103 | NTextChanged(mid1txt); 104 | } 105 | 106 | private void range2txt_TextChanged(object sender, EventArgs e) 107 | { 108 | NTextChanged(range2txt); 109 | } 110 | 111 | private void mid2txt_TextChanged(object sender, EventArgs e) 112 | { 113 | NTextChanged(mid2txt); 114 | } 115 | 116 | private void lineValtxt_TextChanged(object sender, EventArgs e) 117 | { 118 | NTextChanged(lineValtxt); 119 | } 120 | 121 | private void timetxt_TextChanged(object sender, EventArgs e) 122 | { 123 | NTextChanged(timetxt); 124 | } 125 | 126 | private void button1_Click(object sender, EventArgs e) 127 | { 128 | controlconfig.AddOrModifyItem(porttxt.Name, porttxt.Text); 129 | controlconfig.AddOrModifyItem(bodetxt.Name, bodetxt.Text); 130 | controlconfig.AddOrModifyItem(datatxt.Name, datatxt.Text); 131 | controlconfig.AddOrModifyItem(stoptxt.Name, stoptxt.Text); 132 | controlconfig.AddOrModifyItem(range1txt.Name, range1txt.Text); 133 | controlconfig.AddOrModifyItem(mid1txt.Name, mid1txt.Text); 134 | controlconfig.AddOrModifyItem(range2txt.Name, range2txt.Text); 135 | controlconfig.AddOrModifyItem(mid2txt.Name, mid2txt.Text); 136 | controlconfig.AddOrModifyItem(lineValtxt.Name, lineValtxt.Text); 137 | controlconfig.AddOrModifyItem(timetxt.Name, timetxt.Text); 138 | if (button1.Text == "Start") 139 | { 140 | Thread op = new Thread(OpenSP); 141 | op.IsBackground = true; 142 | op.Start(); 143 | openThreadFlag = true; 144 | button1.Text = "Stop"; 145 | } 146 | else 147 | { 148 | if (CTSerialPort.IsComOpen()) 149 | { 150 | readbstopflag = true; 151 | readastopflag = true; 152 | sendFlag = false; 153 | Thread.Sleep(200); 154 | CTSerialPort.CloseSP(); 155 | readbstopflag = false; 156 | readastopflag = false; 157 | } 158 | openThreadFlag = false; 159 | readastopflag = true; 160 | Thread.Sleep(200); 161 | readastopflag = false; 162 | button1.Text = "Start"; 163 | } 164 | } 165 | 166 | private void linebut_Click(object sender, EventArgs e) 167 | { 168 | rangflag = 0; 169 | } 170 | 171 | void OpenSP() 172 | { 173 | while (!CTSerialPort.IsComOpen()) 174 | { 175 | CTSerialPort.SetSP(controlconfig.valueItem("porttxt"), 176 | controlconfig.valueItem("bodetxt"), 177 | controlconfig.valueItem("datatxt"), 178 | controlconfig.valueItem("stoptxt")); 179 | Thread.Sleep(20); 180 | try 181 | { 182 | CTSerialPort.OpenSP(); 183 | } 184 | catch (Exception ex) 185 | { 186 | Console.WriteLine("fail to open {0}", porttxt.Text); 187 | } 188 | } 189 | //Thread ra = new Thread(ReadA); 190 | //openThreadFlag = false; 191 | //ra.IsBackground = true; 192 | //ra.Start(); 193 | 194 | Thread sd = new Thread(SendRandData); 195 | sd.IsBackground = true; 196 | sendFlag = true; 197 | sd.Start(); 198 | } 199 | 200 | void ReadA() 201 | { 202 | byte[] bt = new byte[1024]; 203 | while (!CTSerialPort.ReadSP(ref bt, 1) && bt[0].ToString() != "A" && !readastopflag) 204 | { 205 | Thread.Sleep(20); 206 | } 207 | Console.WriteLine("A Secces", bt[0].ToString()); 208 | Thread rb = new Thread(ReadB); 209 | rb.IsBackground = true; 210 | raFlag = true; 211 | rb.Start(); 212 | Thread sd = new Thread(SendRandData); 213 | sd.IsBackground = true; 214 | sendFlag = true; 215 | sd.Start(); 216 | } 217 | 218 | void ReadB() 219 | { 220 | byte[] bt = new byte[1024]; 221 | while ((!CTSerialPort.ReadSP(ref bt, 1) && bt[0].ToString() != "B") && !readbstopflag) 222 | { 223 | Thread.Sleep(20); 224 | } 225 | Console.WriteLine("B Secces", bt[0].ToString()); 226 | raFlag = false; 227 | sendFlag = false; 228 | } 229 | 230 | void SendRandData() 231 | { 232 | while (sendFlag) 233 | { 234 | UInt16 r1 = Convert.ToUInt16(controlconfig.valueItem(range1txt.Name)); 235 | UInt16 r2 = Convert.ToUInt16(controlconfig.valueItem(range2txt.Name)); 236 | UInt16 m1 = Convert.ToUInt16(controlconfig.valueItem(mid1txt.Name)); 237 | UInt16 m2 = Convert.ToUInt16(controlconfig.valueItem(mid2txt.Name)); 238 | UInt16 line = Convert.ToUInt16(controlconfig.valueItem(lineValtxt.Name)); 239 | byte[] bt; 240 | switch (rangflag) 241 | { 242 | case 0: 243 | bt = RandR(0, line); 244 | CTSerialPort.SendSP(bt); 245 | break; 246 | case 1: 247 | bt = RandR(r1, m1); 248 | CTSerialPort.SendSP(bt); 249 | break; 250 | case 2: 251 | bt = RandR(r2, m2); 252 | CTSerialPort.SendSP(bt); 253 | break; 254 | } 255 | int a = Convert.ToInt32(controlconfig.valueItem(timetxt.Name)); 256 | Thread.Sleep(a); 257 | } 258 | } 259 | 260 | private void rand1but_Click(object sender, EventArgs e) 261 | { 262 | rangflag = 1; 263 | } 264 | 265 | private void rand2but_Click(object sender, EventArgs e) 266 | { 267 | rangflag = 2; 268 | } 269 | 270 | byte[] RandR(UInt16 range, UInt16 mid) 271 | { 272 | Random r = new Random(); 273 | UInt16 s = (UInt16)r.Next(mid - range / 2, mid + range / 2); 274 | byte[] bt = BitConverter.GetBytes(s); 275 | byte temp = bt[1]; 276 | bt[1] = bt[0]; 277 | bt[0] = temp; 278 | //textBox1.Text += s.ToString(); 279 | //textBox1.Text += " "; 280 | textBox1.AppendText(s.ToString() + " "); 281 | return bt; 282 | } 283 | } 284 | } 285 | -------------------------------------------------------------------------------- /震动监测系统/震动监测系统.csproj: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | Debug 6 | AnyCPU 7 | {1E56599A-81FF-4A57-9D89-BA12BC0911F4} 8 | WinExe 9 | 震动监测系统 10 | 震动监测系统 11 | v4.7.2 12 | 512 13 | true 14 | true 15 | false 16 | E:\学校相关\毕设\program\震动监测系统\publish3\ 17 | true 18 | Disk 19 | false 20 | Foreground 21 | 7 22 | Days 23 | false 24 | false 25 | true 26 | 3 27 | 1.0.0.%2a 28 | false 29 | true 30 | true 31 | 32 | 33 | AnyCPU 34 | true 35 | full 36 | false 37 | bin\Debug\ 38 | DEBUG;TRACE 39 | prompt 40 | 4 41 | 42 | 43 | AnyCPU 44 | pdbonly 45 | true 46 | bin\Release\ 47 | TRACE 48 | prompt 49 | 4 50 | 51 | 52 | D99D16A5F14F856BC108E2D284C74A6A321247B8 53 | 54 | 55 | 震动监测系统_TemporaryKey.pfx 56 | 57 | 58 | true 59 | 60 | 61 | false 62 | 63 | 64 | 65 | ..\packages\BouncyCastle.1.8.3.1\lib\BouncyCastle.Crypto.dll 66 | 67 | 68 | ..\packages\Google.Protobuf.3.6.1\lib\net45\Google.Protobuf.dll 69 | 70 | 71 | ..\packages\MySql.Data.8.0.19\lib\net452\MySql.Data.dll 72 | 73 | 74 | ..\packages\SSH.NET.2016.1.0\lib\net40\Renci.SshNet.dll 75 | 76 | 77 | 78 | 79 | 80 | 81 | 82 | 83 | 84 | 85 | 86 | 87 | 88 | 89 | 90 | 91 | 92 | 93 | 94 | 95 | 96 | 97 | ..\packages\MySql.Data.8.0.19\lib\net452\Ubiety.Dns.Core.dll 98 | 99 | 100 | 101 | 102 | 103 | 104 | 105 | 106 | Form 107 | 108 | 109 | Form1.cs 110 | 111 | 112 | Form 113 | 114 | 115 | FormHistoryData.cs 116 | 117 | 118 | Form 119 | 120 | 121 | FormSaveWaiting.cs 122 | 123 | 124 | Form 125 | 126 | 127 | FormSignIn.cs 128 | 129 | 130 | Form 131 | 132 | 133 | FormUserManage.cs 134 | 135 | 136 | Form 137 | 138 | 139 | FormWave.cs 140 | 141 | 142 | Form 143 | 144 | 145 | Form_SP_Set.cs 146 | 147 | 148 | Form 149 | 150 | 151 | Form_SP_Test.cs 152 | 153 | 154 | 155 | 156 | True 157 | True 158 | 震动监测系统DataSet.xsd 159 | 160 | 161 | Form1.cs 162 | 163 | 164 | FormHistoryData.cs 165 | 166 | 167 | FormSaveWaiting.cs 168 | 169 | 170 | FormSignIn.cs 171 | 172 | 173 | FormUserManage.cs 174 | 175 | 176 | FormWave.cs 177 | 178 | 179 | Form_SP_Set.cs 180 | 181 | 182 | Form_SP_Test.cs 183 | 184 | 185 | ResXFileCodeGenerator 186 | Resources.Designer.cs 187 | Designer 188 | 189 | 190 | True 191 | Resources.resx 192 | 193 | 194 | 195 | SettingsSingleFileGenerator 196 | Settings.Designer.cs 197 | 198 | 199 | True 200 | Settings.settings 201 | True 202 | 203 | 204 | 震动监测系统DataSet.xsd 205 | 206 | 207 | MSDataSetGenerator 208 | 震动监测系统DataSet.Designer.cs 209 | Designer 210 | 211 | 212 | 震动监测系统DataSet.xsd 213 | 214 | 215 | 216 | 217 | 218 | 219 | 220 | 221 | False 222 | Microsoft .NET Framework 4.7.2 %28x86 和 x64%29 223 | true 224 | 225 | 226 | False 227 | .NET Framework 3.5 SP1 228 | false 229 | 230 | 231 | 232 | 233 | {FB55F73E-451C-4012-B90E-A6AF9BA7E22E} 234 | WindowsFormsControlLibrary1 235 | 236 | 237 | 238 | --------------------------------------------------------------------------------