Example #1
0
        }                                                                               //	結束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());
            })));                                                                           //	結束指令工作內容
        }
Example #2
0
        }                                                                               //	結束comboBox1_text_change方法

        public void list_SerialPort()                                                   //	偵測並列出已連線SerialPort方法
        {                                                                               //	進入list_SerialPort方法
            DebugVariables.Set_list_SerialPort_Runtimes();                              //	呼叫Set_list_SerialPort_Runtimes方法遞增list_SerialPort_Runtimes變數
            ComportListToComboBox(UARTConnection1.GetComportList(), comboBox1);         //	將Comport偵測結果更新至下拉式選單

            /*if (ports.Length == 0)                                              //	若偵測不到任何已連接的SerialPort(ports.Length為0)
             * {                                                                   //	進入if敘述
             *      ErrorCodeMessage.Error_Message_Show((int)ErrorCodeMessage.ErrorCodeEncoding.NoSerialPortConnected);
             *      //	顯示錯誤訊息
             *      button2.Enabled = false;                                        //	關閉"連線/中斷連線"按鈕功能
             *      textBox1.Enabled = false;                                       //	關閉textBox1(接收字串資料文字方塊)功能
             *      return;                                                         //	提早結束list_SerialPort方法
             * }                                                                   //	結束if敘述
             * else                                                                //	若偵測到已連線的SerialPort
             * {                                                                   //	進入else敘述
             *      button2.Enabled = false;                                        //	暫時關閉"連線"按鈕功能,待使用者選定愈連線之Serialport(未選定連線Serialport,可避免發生Error_010002)
             *      textBox1.Enabled = true;                                        //	開啟textBox1(接收字串資料文字方塊)功能
             *      return;                                                         //	結束list_SerialPort方法
             * }                                                                   //	結束else敘述*/
        }                                                                               //	結束list_SerialPort方法