//public SerialPort port = new SerialPort("COM23", 115200, Parity.None, 8, StopBits.One); public TrainingForm(ControlForm controlForm) { InitializeComponent(); cntrlForm = controlForm; msgWorker.WorkerReportsProgress = true; // Enable progress reporting // Hook up event handlers msgWorker.DoWork += msgWorker_DoWork; msgWorker.RunWorkerCompleted += msgWorker_RunWorkerCompleted; msgWorker.ProgressChanged += msgWorker_ProgressChanged; progressWorker.WorkerReportsProgress = true; // Enable progress reporting // Hook up event handlers progressWorker.DoWork += progressWorker_DoWork; progressWorker.RunWorkerCompleted += progressWorker_RunWorkerCompleted; progressWorker.ProgressChanged += progressWorker_ProgressChanged; trainWorker.WorkerReportsProgress = true; // Enable progress reporting // Hook up event handlers trainWorker.DoWork += trainWorker_DoWork; trainWorker.RunWorkerCompleted += trainWorker_RunWorkerCompleted; trainWorker.ProgressChanged += trainWorker_ProgressChanged; colourFlasher.WorkerReportsProgress = true; // Enable progress reporting // Hook up event handlers colourFlasher.DoWork += colourFlasher_DoWork; //colourFlasher.RunWorkerCompleted += colourFlasher_RunWorkerCompleted; colourFlasher.ProgressChanged += colourFlasher_ProgressChanged; //controlForm.port.DataReceived += new SerialDataReceivedEventHandler(port_DataReceived); // Attach a method to be called when there is data waiting in the port's buffer }
public ConnectForm(ControlForm controlForm) { InitializeComponent(); this.cntrlForm = controlForm; comboBox_ports.Items.Clear(); for (int i = 1; i <= 30; i++) { comboBox_ports.Items.Add("COM" + i.ToString()); } }