static SerialPort serialPort = new SerialPort("COM1", 9600, Parity.None, 8, StopBits.One); //定义一个串口类的串口变量 #endregion Fields #region Methods static void Main(string[] args) { Menu menu = new Menu("串口通信示例"); menu.AddCommand("status", new Function(ShowStatus)); menu.AddCommand("switch", new Function(SwitchPort)); menu.AddCommand("set", new Function(SetPort)); menu.AddCommand("send", new Function(SendData)); menu.Start(); }
static void Main(string[] args) { Menu Menu = new Menu("My Awesome Menu"); Menu.AddMenuItem("point 1", "Bob the builder was here!"); Menu.AddMenuItem("point 2", "Bob the builder have yet to come here!"); Menu.AddMenuItem("point a bit longer", "Bob the builder will never come here!"); Menu.Start(); }