MQTT客户端Paho实现C#应用
1、打开C#工程,然后 打开“工具”-“Nuget包管理器”-“程序包管理器控制台”。
2、输入命令,安装M2Mqtt 包。
NuGet\Install-Package M2Mqtt -Version 4.3.0
3、MQTT服务器。
Broker: broker.emqx.io
TCP Port: 1883
WebSocket Port: 8083
4、测试代码。
using System;
using System.Colle
1、打开C#工程,然后 打开“工具”-“Nuget包管理器”-“程序包管理器控制台”。
2、输入命令,安装M2Mqtt 包。
NuGet\Install-Package M2Mqtt -Version 4.3.0
3、MQTT服务器。
Broker: broker.emqx.io
TCP Port: 1883
WebSocket Port: 8083
4、测试代码。
using System;
using System.Colle
一、安装StackExchange.Redis
通过NuGet 安装 StackExchange.Redis。
二、字符串
using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.Data;
using System.Drawing;
using System.Linq;
using System.Text;
using
NuGet安装Newtonsoft.Json
using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.Data;
using System.Drawing;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using System.Windows
SeriesChartType.Line 折线 SeriesChartType.Spline 曲线
using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.Data;
using System.Drawing;
using System.Linq;
using System.Text;
using System.Threading.Ta
using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.Data;
using System.Drawing;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using System.Windows.Forms;
using System.Wi
using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.Data;
using System.Drawing;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using System.Windows.Forms;
using System.Wi
using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.Data;
using System.Drawing;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using System.Windows.Forms;
using System.Wi
using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.Data;
using System.Drawing;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using System.Windows.Forms;
using System.Wi
using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.Data;
using System.Drawing;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using System.Windows.Forms;
using System.Wi
Series->ChartType 选择图标类型。
using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.Data;
using System.Drawing;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using Syste
一、演示
using System;
using System.Collections.Generic;
using System.Collections.Specialized;
using System.ComponentModel;
using System.Configuration;
using System.Data;
using System.Drawing;
using System.IO;
using System.Linq;
us
1、创建一个ASP.NET Web项目。选中Web API。
2、创建一个控制器 BillController
using Newtonsoft.Json;
using Newtonsoft.Json.Linq;
using System;
using System.Collections.Generic;
using System.Linq;
using System.Net;
using System.Net.Http;
using System.W
一、工具类
using System;
using System.Collections.Generic;
using System.Configuration;
using System.IO;
using System.Linq;
using System.Net;
using System.Text;
using System.Threading.Tasks;
namespace sync
{
public class HttpApiHel
在NuGet中安装FreeSpire.XLS。
using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.Data;
using System.Drawing;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using System.Window
1、父窗体
/// <summary>
/// 弹窗
/// </summary>
/// <param name=”sender”></param>
/// <param name=”e”></param>
private void btnPopWin_Click(object sender, EventArgs e)
{
FormItem formItem = new FormIte
1、NuGet安装QRCoder库。
2、测试代码。
using QRCoder;
using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.Data;
using System.Drawing;
using System.Drawing.Imaging;
using System.IO;
using System.Linq;
注意:在项目工程里面–管理NuGet程序包–搜索你需要的包(nmodbus4)–安装即可。
// 私有串口实例
private SerialPort serialPort = new SerialPort();
// 设定串口参数
serialPort.PortName = cbxPort.SelectedItem.ToString();
serialPort.BaudRate = 9600;
serialPort.Parity = Parity.Non
下载地址:https://github.com/S7NetPlus/s7netplus
S7.Net 与 S7-200,S7-300,S7-400,S7-1200 和 S7-1500 兼容。
// 创建一个 PLC 实例,连接和断开连接
Plc plc = new Plc(CpuType.S7200Smart, “192.168.2.1”, 0, 0);
// 连接到 PLC
plc.Open();
//public object Read(string varia
1、下载安装包。
https://globalcdn.nuget.org/packages/microsoft.netframework.referenceassemblies.net45.1.0.2.nupkg
2、以 rar 方式解压下载的安装包.nupkg(可以直接修改后缀名为 .rar 再进行解压)。
3、复制目录。
将microsoft.netframework.referenceassemblies.net45.1.0.2.rar\build\.NETFramewor
using System.Drawing;
using System.Drawing.Drawing2D;
// 创建画布,这里的画布是由Form提供的。
Graphics graphics = this.CreateGraphics();
// 底色填充为灰色
Brush white = new SolidBrush(Color.Gray);
graphics.FillRectangle(white, new Rectangle(0, 0, 300, 300));