private void button_Click(object sender, EventArgs e) { Tuple <ChannelId, Control> channel = pannelControlList.Find(t => t.Item2 == sender); if (channel != null) { if (arduinoport.IsConnected) { arduinoport.Send((byte)channel.Item1); } } }
private void LabelInputRequest(object sender, EventArgs e) { if (sender == label1) { if (arduinoport.IsConnected) { arduinoport.Send((byte)ChannelId.MonitorField_1); } } if (sender == label2) { if (arduinoport.IsConnected) { arduinoport.Send((byte)ChannelId.MonitorField_2); } } if (sender == label3) { if (arduinoport.IsConnected) { arduinoport.Send((byte)ChannelId.MonitorField_3); } } if (sender == label4) { if (arduinoport.IsConnected) { arduinoport.Send((byte)ChannelId.MonitorField_4); } } if (sender == label5) { if (arduinoport.IsConnected) { arduinoport.Send((byte)ChannelId.MonitorField_5); } } if (sender == label6) { if (arduinoport.IsConnected) { arduinoport.Send((byte)ChannelId.MonitorField_6); } } }