I’m new to C# and I’m creating a telemetry dashboard, and one of the buttons opens the serial monitor. When I press the button that opens it, I want an if command to occur every code cycle that does some code without using a separate thread because the code I want to activate requires it to be in the same thread as the form.
I’ve tried using separate threads but as I said, I need the code to be in the same thread as the main loop. All I want is an if command that will run every code cycle only if the button’s bool status is true.
main code loop
{
private void button_open_click(object sender, EventArgs e)
{
buttonOpen.Enabled = true;
}
if (buttonOpen.Enabled == true)
{
// write serial data to charts
}
}
user25999134 is a new contributor to this site. Take care in asking for clarification, commenting, and answering.
Check out our Code of Conduct.
1