} // 結束CommandDatabase建構子 /// <summary> /// CreateCommandSet方法用於建立命令集合 /// </summary> public void CreateCommandSet() { CommandSet.Add(new CommandClass( // Add command, 新增指令 1, // 指令編號 "connect", // 指令名稱 new System.Threading.Tasks.Task(() => // 建立指令工作 { // 進入指令工作內容 }))); // 結束指令工作內容 CommandSet.Add(new CommandClass( // 新增指令 2, // 指令編號 "help", // 指令名稱 new System.Threading.Tasks.Task(() => // 建立指令工作 { // 進入指令工作內容 }))); // 結束指令工作內容 CommandSet.Add(new CommandClass( // 新增指令 3, // 指令編號 "lscom", // 指令名稱 new System.Threading.Tasks.Task(() => // 建立指令工作 { // 進入指令工作內容 UARTConnection UARTConnection1; // 宣告UARTConnection1物件 UARTConnection1 = new UARTConnection(0, false); Console.WriteLine(UARTConnection1.GetComportList().ToString()); }))); // 結束指令工作內容 CommandSet.Add(new CommandClass( // 新增指令 3, // 指令編號 "version", // 指令名稱 new System.Threading.Tasks.Task(() => // 建立指令工作 { // 進入指令工作內容 Console.WriteLine(VersionInfo.Instance.GetProgramVersion()); }))); // 結束指令工作內容 }
delegate void Display(byte[] buffer); // 定義Display型態 //delegate 是可用來封裝具名方法或匿名方法的參考型別。 /// <summary> /// Form1方法 /// </summary> public Form1() // 宣告Form1方法 { // 進入Form1(由Program.cs的Main呼叫執行) UARTConnection1 = new UARTConnection(); // 初始化UARTConnection1物件 InitializeComponent(); // 呼叫InitializeComponent方法(於Form1.Designer.cs中)初始化表單 UARTConnection1.InitializeUARTConnectionSetting(); // 呼叫InitializeUARTConnectionSetting初始化UART連線 } // 結束Form1方法