private void CmdOutput_TextChanged(object sender, EventArgs e) { bool isrunning = paexecService.IsRunning; KillButton.Invoke(new Action(() => KillButton.Enabled = isrunning)); ConnectButton.Invoke(new Action(() => ConnectButton.Enabled = isrunning));; }
private void ClientConnected(object sender, SocketEventArgs e) { ConnectButton.Invoke(new Action(() => { ConnectButton.Enabled = false; })); }
private void ClientDisconnected(object sender, SocketEventArgs e) { System.Diagnostics.Debug.WriteLine("Re-enabling the start button"); ConnectButton.Invoke(new Action(() => { ConnectButton.Enabled = true; })); }
private void Port_ErrorReceived(object sender, SerialErrorReceivedEventArgs e) { // In caso di errore cambio il testo sul pulsante port.Close(); if (ConnectButton.InvokeRequired) { ConnectButton.Invoke((Action)(() => UpdateText(ConnectButton, "Connect"))); return; } else { UpdateText(ConnectButton, "Connect"); } }