报警器实例:(有发送,无返回获取) using System; using System.Collections.Generic; using System.Linq; using System.Text; using System.IO.Ports; using System.Text.RegularExpressions; using System.Windows.Forms; namespace ZKJFJK { /*** 报警器语音输出类,只需在调用时填写需要播报汉字即可 * 例:boo
最近写C#串口通信程序,系统是B/S架构.SerialPort类有一个DataReceived事件,用来接收串口返回的数据,但这种方式在C/S架构下很好用,但B/S就不好处理了.所以写了一个同步模式接收返回数据的方法,不使用DataReceived事件.经过测试,可以正常使用. 一.MachineFactory类 为什么使用工厂类:售货机由不止一个厂家提供,接口协议都不一样. using System; using System.Collections.Generic; using System