コード例 #1
0
 private void Form1_Load(object sender, EventArgs e)
 {
     serialport = LLSerialPortFactory.CreateInstance("LLSerialImplement"); //create the instance
     serialport.OpenSerialPort("COM3");                                    //open the serial port
     serialport.DataUpdated += (s, data) => {                              //data come event
         richTextBox1.UISafeSet(() => {
             foreach (var item in data.SerialData)
             {
                 richTextBox1.AppendText("0x" + item.ToString("X") + "\t");//hex display
             }
             richTextBox1.AppendText("\n");
         });
     };
 }
コード例 #2
0
 /// <summary>
 /// the Serial implement name
 /// </summary>
 /// <param name="SerialName"></param>
 /// <returns></returns>
 public static LLSerialPort CreateInstance(string SerialName)
 {
     _llserial = (LLSerialPort)Assembly.Load("SerialPortEX").CreateInstance("SerialPortEX." + SerialName);
     return(_llserial);
 }