public async Task DisconnectDevice() { _connectedPortManager?.Stop(); await Task.Delay(500); //To let things wrap up _receivedDataAction = null; _connectedPortManager?.Dispose(); _connectedPortManager = null; }
public async void SetDeviceAsDisconnected() { _receivedDataAction = null; if (_connectedPortManager != null) { if (_connectedPortManager.IsRunning) { _connectedPortManager.Stop(); await Task.Delay(500); //To let things wrap up } if (!_connectedPortManager.IsDisposed) { _connectedPortManager.Dispose(); } _connectedPortManager = null; } }
private void OnShutdownStarted(object sender, EventArgs e) { SettingsManager.Save(); PortManager.Dispose(); _usbNotification.Dispose(); }