Exemplo n.º 1
0
 private void button3_Click(object sender, EventArgs e)
 {
     if (thread != null)
     {
         richTextBox1.Text += "---------- SERIAL READ THREAD END REQUEST ----------" + "\n";
         richTextBox1.Text += "---------- WAITING ----------" + "\n";
         thread.Close();
         thread             = null;
         richTextBox1.Text += "---------- SERIAL READ THREAD ENDED ----------" + "\n";
     }
 }
Exemplo n.º 2
0
        private void button2_Click(object sender, EventArgs e)
        {
            Object selectedItem = serialComboBox.SelectedItem;
            string current_port = selectedItem.ToString();

            //SerialPort serial_port = new SerialPort(current_port, 9600);
            //serial_port.Open();
            richTextBox1.Text += "---------- SERIAL READ THREAD STARTING ----------" + "\n";
            if (thread == null)
            {
                thread = new SerialReaderThread(current_port);
                thread.DataReceived += ThreadDataReceived;
                thread.Start();
            }
            text_reading = true;
        }