private async void DisconnectButton_Click(object sender, EventArgs e) { if (tciClient != null) { await tciClient.DisConnectAsync(); } else { return; } foreach (var transceiver in tranceiverController.Transceivers) { transceiver.OnTrx -= TransceiverController_OnTrx; transceiver.OnTune -= TransceiverController_OnTune; transceiver.OnModulationChanged -= TransceiverController_OnModulationChanged; } tciClient.TransceiverController.OnDrive -= TransceiverController_OnDrive; tciClient.TransceiverController.OnTuneDrive -= TransceiverController_OnTuneDrive; tciClient.TransceiverController.OnStarted -= TransceiverController_OnStarted; tciClient.TransceiverController.OnStopped += TransceiverController_OnStopped; tciClient = null; }
public void Dispose() { serialPort?.Close(); tciClient?.DisConnectAsync(); }