private void scheduleTimeoutTimer() { timeoutTimer = new System.Threading.Timer( obj => { this.Invoke((MethodInvoker) delegate { if (controller != null && controller.connected) { controller.disconnect(true); } }); }, null, 50000, Timeout.Infinite); }
private async void disconnect() { if (timeoutTimer != null) { timeoutTimer.Dispose(); timeoutTimer = null; } if (controller != null && controller.connected) { if (engineStatus != 0) { engine(0); } else { clearEngineTask(); } if (engineTask != null) { await engineTask; engineTask.Dispose(); engineTask = null; } toggleLine(currentTemplate.ledLine, 0); controller.disconnect(); } }
private void cbConnectTerminal_CheckedChanged(object sender, EventArgs e) { if (cbConnectTerminal.Checked) { connectTerminal(); } else { if (terminalJConnection != null) { terminalJConnection.disconnect(); } cbConnectTerminal.ForeColor = defForeColor; } }
private void FWX0B_FormClosing(object sender, FormClosingEventArgs e) { closingFl = true; terminalJConnection?.disconnect(); setActiveController(-1); }